Three small topics round off the basic tags. They look unrelated, but each answers a question every beginner hits sooner or later: how do I divide content, how do I type special characters, and why does my spacing disappear?
The hr element#
<hr> represents a thematic break, a shift of topic between paragraphs. Browsers draw it as a horizontal line.
<h2>Breakfast</h2>
<p>Eggs, toast and masala tea served until 11am.</p>
<hr>
<h2>Lunch</h2>
<p>Soup of the day with fresh bread.</p>Like <br>, it is a void element. It has meaning, not just looks: it says "the topic changes here." If you only want a decorative line, create it with a CSS border instead.
Character entities#
Some characters have special meaning in HTML. The less-than sign starts a tag, so you cannot just type it into your text. Other characters are not on a keyboard at all. For both cases, HTML has entities: codes that begin with an ampersand and end with a semicolon.
<p>Fish & chips costs 5 < 6 euros, a "bargain".</p>
<p>© 2025 Brew and Byte. All rights reserved.</p>
<p>Price: €4 — or about Rs. 600.</p>The most useful entities:
| Entity | Result | Use |
|---|---|---|
< | the less-than sign | Showing a tag in text |
> | the greater-than sign | Showing a tag in text |
& | the ampersand | Typing an ampersand safely |
" | a double quote | Quotes inside attribute values |
| a non-breaking space | Keep two words on one line |
© | the copyright sign | Footers |
You can also use numeric forms, such as © for the copyright symbol. With UTF-8 encoding (<meta charset="utf-8">) you can often type characters like the rupee symbol directly, but entities remain essential for the reserved characters <, > and &.
To show a code sample containing tags, escape the brackets:
<p>To make a paragraph, write <code><p>Hello</p></code>.</p>How whitespace behaves#
HTML collapses whitespace. Any run of spaces, tabs and line breaks becomes a single space when displayed.
<p>Fresh coffee
every
morning.</p>This shows as "Fresh coffee every morning." on one line. That is a feature: you can format your source neatly without changing the page. To force extra spacing:
- Use CSS margins and padding for layout.
- Use
<br>for a deliberate line break inside text. - Use
<pre>when you really need to preserve spaces and line breaks, such as in code or ASCII art.
<pre>
Espresso Rs. 150
Latte Rs. 220
</pre>Common mistakes#
- Typing a raw
<in text and watching the content disappear because the browser sees a tag. - Forgetting the semicolon at the end of an entity.
- Using
<hr>just as decoration. - Pressing Enter several times in source and expecting blank lines.
- Using
for layout.
Try it yourself#
Write a footer line reading: "(c) 2025 Brew and Byte - Tea & Coffee" using the proper copyright entity and an escaped ampersand. Separate two sections of your page with <hr>. Then write a short paragraph with five blank lines and ten spaces in the source, view it in the browser, and explain what happened. Finally wrap a menu in <pre> and compare.
Recap#
hr marks a change of topic. Entities such as <, > and & let you display reserved or special characters. Browsers collapse whitespace, so use CSS for spacing, br for line breaks in text and pre for preformatted text.
Check your understanding
Lesson quiz
OptionalA short quiz to check what you just learned.
- Questions
- 4
- Time limit
- 5 min
- Pass mark
- 70%
- Best score
- -