On this page11 sections
Lecture 027: Entities, Symbols & Emojis
| Category | 5: Code, Characters & Standards |
| Lecture | 027 of 048 |
| Estimated video length | 12 min |
| Target | HTML5 · any modern browser |
| Level | Beginner |
Some characters have a special meaning in HTML, so you can't just type them. Others, such as © or →, aren't on your keyboard. Entities let you write any character, including maths symbols, currency signs and emojis, using a short code.
Learning Objectives
- Write reserved characters such as
<,>and&with entities - Use named and numeric entities for symbols
- Keep words together with a non-breaking space
- Add emojis to a page
1. Why Entities Exist
The browser reads < as the start of a tag. To show a < on the page, write <.
Example
<p>In HTML, a paragraph starts with <p> and ends with </p>.</p>
<p>Fish & chips costs < Rs 1,000.</p>An entity starts with & and ends with ;.
2. Entities You'll Use Most
| Shows | Name | Number |
|---|---|---|
| < | < | < |
| > | > | > |
| & | & | & |
| " | " | " |
| ' | ' | ' |
| © | © | © |
| ® | ® | ® |
| ™ | ™ | ™ |
| (non-breaking space) | |   |
Names are easier to remember; numbers work for every character.
3. The Non-Breaking Space
A normal space lets the browser start a new line there. doesn't, so it keeps
things together, such as a number and its unit.
Example: drag the preview corner narrower:
<p style="width: 180px; border: 1px dashed #aaa;">The flight takes 10 hours and costs Rs 95,000.</p>Don't use lots of for spacing. That's a job for CSS.
4. Symbols
Example
<p>Maths: 5 × 4 ÷ 2 ≠ 11 | ∑ √ ∞ ≤ ≥</p>
<p>Arrows: ← ↑ → ↓ ↔</p>
<p>Currency: € £ ¥ ₨ (rupee sign)</p>
<p>Greek: α β π Ω</p>
<p>Card suits: ♠ ♣ ♥ ♦</p>5. Diacritical Marks
Accents can be added to a letter with a combining character after it:
<p>à á â ã</p>In practice, since your page uses UTF-8 (Lecture 028), you can simply type é, ü or ñ.
6. Emojis
Emojis are ordinary characters, so you can paste them straight in, or use their numbers.
Example
<meta charset="UTF-8">
<p style="font-size: 40px;">😀 😀 😀</p>
<p>Ready? 🎉 Let's go 🚀</p>😀is the decimal number;😀is the same in hexadecimal.- Emojis look different on Android, iPhone and Windows, because each draws its own.
- Use them as decoration; important meaning should also be in words.
Common Beginner Mistakes
1. Forgetting the semicolon. © may work, but © always does.
2. A raw & in URLs inside HTML. Strictly it should be &: href="search?q=tea&page=2". Browsers usually cope, but validators complain.
3. Spacing with . Use CSS margins and padding.
4. Emojis as the only label. A screen reader may say "rocket", which might not be what you mean.
Practice Questions
- How do you show
<div>as text on a page? - What's the entity for the copyright symbol?
- What does
do? - Write "5 × 3 = 15" using an entity for the multiplication sign.
- Name two ways to add an emoji to a page.
- Why do emojis look different on different phones?
Practice Answers
<div>©- It's a space that never breaks onto a new line.
5 × 3 = 15- Paste the emoji directly, or use its number, such as
😀. - Each operating system draws its own emoji pictures.
Key Takeaways
- Entities start with
&and end with;:<,>,&,©. - Numeric entities (
©) can write any character. keeps words together on one line.- Emojis are characters: paste them, or use
&#…;.