How To Homepage: easy website guide

Introduction to line breaks and special characters, which are treated specially in HTML

Line breaks and special characters

Line breaks are essential in writing, don't you think? In HTML, even line breaks have their own tags.

Not only that, but symbols such as > and < are considered special characters. They need to be written in a special way to display on a webpage.

Here, we will talk about line breaks and special characters.

The <br> tag forces line breaks

Even if you insert a line break in the source code by hitting enter, it will not be a line break when displayed in a browser.

Therefore, you must use a HTML tag to create a line break. This tag is <br>.

This tag is called an empty element because it is not addded with start and end tag pair. It is entirely self-contained.

[Example]

Here's where we will insert a line break. <br> A line break has been inserted.

[Display example]

Here's where we will insert a line break.
A line break has been inserted.

Strictly speaking, you're supposed to write <br />, but that's not necessary anymore. So don't sweat it.

Special characters

In HTML, there are some symbols that browsers might not display even if you write them down. For example, < and > are used for parsing HTML tags, so how are you supposed to tell the computer you actually want your visitor to see this?

Characters like this are written in the source code with a format like &XXX;. It looks weird in the code, but your browser shows them totally normal!

Symbol Code Symbol Code Symbol Code
< ©&lt; © &copy; &larr;
> &gt; \ &yen; &rarr;
" &quot; &radic; &uarr;
& &amp; &infin; &darr;

There are many more special characters than this. Check out the list of special characters to learn more.