HTML Tutorial
HTML Entities
Entities print reserved characters: less-than, ampersand, copyright, and non-breaking space.
Characters the markup already uses
HTML source is text, but a few characters are not ordinary text. The parser treats< as “a tag starts here” and & as “an entity starts here.” If you want those characters to appear on the page, you write an entity — a short name the parser turns into the real character after it has finished reading tags.
An entity starts with & and ends with ;. Named entities such as< are easy to remember. Numeric entities such as © work too. Beginners can stay with the named set in the table below.
Why a raw less-than breaks the parser
Suppose you want the sentence “If score is 5 < 10, you pass.” If you type a real< into the paragraph, the browser does not see a comparison. It sees the start of a tag named “ 10, you pass.” That is not a valid tag, so the rest of the paragraph can vanish, wrap oddly, or swallow following markup.
Example — this source is wrong
<p>If the score is 5 < 10, you pass.</p>
<p>Tom & Jerry play piano.</p>The first line starts a malformed tag at < 10. The second line starts an entity at& that never ends, so Jerry can be eaten or shown incorrectly. Always encode these two in text: less-than as <, ampersand as &.
Greater-than (>) is safer in text, but write > anyway so the file is obvious to the next reader. In attribute values, quote the value and still encode& and, when needed, the quote character itself.
Source versus rendered
The live preview at /html/try shows the rendered page, not the entity names. In the editor you type ©. On the page you see ©. That gap is the whole point of entities.
Example — correct source
<p>If the score is 5 < 10, you pass.</p>
<p>Tom & Jerry play piano.</p>
<p>5 > 2 is also true.</p>
<p>He said "open early."</p>
<p>Copyright © 2026 Eastside Bakery.</p>
<p>Keep this together on one line.</p>The same file paints as:
If the score is 5 < 10, you pass.
Tom & Jerry play piano.
5 > 2 is also true.
He said "open early."
Copyright © 2026 Eastside Bakery.
Keep this together on one line.
The entities you will type daily
| Entity | Renders as | Use it for |
|---|---|---|
< | < | Less-than in text or examples of HTML |
> | > | Greater-than |
& | & | A real ampersand: company names, query strings in text |
| a non-breaking space | A space that will not wrap to the next line |
© | © | The copyright sign |
" | " | A double quote inside a double-quoted attribute |
To show HTML tags in a tutorial, you encode both brackets: <p> renders as<p>. Never put a raw <p> in the middle of a sentence unless you intend to start a paragraph element.
Non-breaking space
A normal space is a wrap opportunity. The browser may split “10 km” so that “10” ends one line and “km” starts the next. is a space that refuses to break. Use it for units, initials, and short phrases you want to keep on one line — not as a way to indent paragraphs.
Example
<p>The loaf weighs 900 g.</p>
<p>Meet at 14 Harbor Lane.</p>
<p>Chapter 4 is the forms track.</p>Do not chain dozens of entities to push text sideways. That is layout, and layout belongs in CSS. The entity is for “do not split this pair.”
Quotes, copyright, and attributes
Inside element content, a straight " is usually fine. Inside an attribute that is already wrapped in double quotes, a raw " would end the attribute early. Write" or switch the attribute to single quotes.
©is © — typical in a footer:Copyright © 2026."is"— typical intitle="He said "hello"".- You can also write curly quotes as characters if the file is UTF-8. Entities are required only when the character would confuse the parser.
Ampersand is the one people forget in URLs pasted as text: a=1&b=2 in a paragraph. In a real href you still encode it: href="search?a=1&b=2".
What to remember
- A raw
<in text starts a tag. Write<instead. - A raw
&starts an entity. Write&for a real ampersand. is a space that will not wrap.©is ©."is a double quote.- The editor shows source. The preview shows characters. Both views are correct.
Next: the character set. UTF-8 is how the file stores José, Søren, and every other letter the web uses.
Worked examples
The short listings above show the tag in isolation. These pages use the same markup on documents you would actually publish: a lab report, a clinic form, a timetable, a weather card.
HTML does not calculate. It names the pieces so a browser, a screen reader, and a search engine can tell a heading from a paragraph. The numbers below are classroom values — the same Ohm, pH, and pulse figures as the C track — now sitting in real page structure.
Preview them in the HTML editor at /html/try. Change a heading or a number and watch the page, not a print log.
Maths
Less-than in a sentence
The characters <, >, and & start markup. To show them as text you write <, >, and &. Otherwise the browser thinks a tag has begun.
nbsp is a non-breaking space: 12 kg stays on one line. Use it for number and unit, not for indenting paragraphs.
pH < 7 means acidic
Example
<p>Acidic if pH < 7</p>
<p>Toast & tomato</p>
<p>Mass 12 kg</p>Physics
Degree and micro
UTF-8 can store ° and µ directly if charset is set. Entities still help when a keyboard cannot type them. Either way, the visitor should see 20 °C, not 20 C.
Example
<p>20 °C is 293.15 K</p>
<p>Earth’s field is about 50 µT</p>