HTML entities and a few random tags to know

If you watched the Unit 2 J215 videos, you may have seen something like this in the HTML: ".

This is called an Entity. Entities are codes to use for symbols that you need in text but that are part of the HTML coding. For instance, if you need a greater than or less than symbol in your text, what do you do? Because those symbols are part of the code.

(<$50 will come up as a code error.)

You use HTML entities. Less than is typed as &lt; and greater than is typed as &gt; etc.

The ones you will probably see the most in HTML you check out are nonbreaking spaces and the ampersand. Remember, the HTML text editor doesn’t recognized spaces you put in your HTML index file as spaces in the end product. So if you want an extra space between words, you need to type in &nbsp; (the end symbol is the semicolon on all of these).

An ampersand is &amp; and a double quote mark is &quot;.

To get a copyright symbol, type &copy;.

You can also look up online how to find diacritical marks.


A couple of other random things that are good to know.

<hr> This gives you a rule. It doesn’t need a end bracket (so it’s empty code). HR actually defines any thematic break in the HTML, but unless you code it differently, it will give you a single rule.

<br> Also empty code. It gives you a line break. So it’s a way to end a line short or to add a line of space.

<pre> Lets you enter text in a preformatted way. In other words, your spacing won’t be ignored. It may sometimes be called the poem solution.

A couple of overall tags you might use: <body> defines the document’s body. <article> defines one area (one article) on the page. <html> is the root of the document and is usually at the top with the <head>, which is where the meta data for the document lives (so character set, language, CSS stylesheet links, title of your web page and a description of your web page).

For instance, you need to define the page’s language. And UTF-8 is the standard character set right now, and includes letters from various alphabets, numbers, symbols and emojis.

Here’s an idea of what that would look like: (This type of structure should go at the top of every page file.)

— Gerri Berendzen