PGTUTOR.COM
You are here: HOME >> HTML tutor >> Lesson 8

HTML tutor- Lesson 8

In this lesson we'll learn about special characters or entities. I'll start off with an example right away.

What happens when you type the following:

<body>
A  B    B    B  A
</body>

View your webpage here


This shouldn't come as too much of a surprise. So, how do you fix this. Those of you who're thinking about using pre tags: Good for you but that also changes the font type to monospaced.

In HTML &nbsp; is a single space character. It works very similar to the other tags we've laerned. Compare it with the head tag:

<head>
&nbsp;

In the head tag < marks the beginning of the tag and > marks the end. In &nbsp; & marks the beginning and ; the end.

Coming back to our original example, here's what we can do:

<body>
A&nbsp;&nbsp;B&nbsp;&nbsp;&nbsp;&nbsp;
B&nbsp;&nbsp;&nbsp;&nbsp;B&nbsp;&nbsp;A
</body>

View your webpage here


Similar to &nbsp; there's many other character entities. The most commonly used ones are:

&nbsp; - non-breaking space
&lt; - < (less than symbol)
&gt; - > (greater than symbol)
&quot; - " (quotation mark symbol)
&amp; - & (ampersand symbol)
&copy; - © (copyright)

You can find the complete list at W3Schools Latin-1 Character Reference

PgTutor - The easy way to make a website ...
Lessons: Intro 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25



PGTUTOR is an award winning website. In the past 2 years, we've won over 20 legitimate awards. Go to our awards page to verify for yourself.




You're not taking a risk when buying our products. If for any reason you're unsatisfied with the quality of our product(s), we'll refund your money. Also, you get to keep the product you bought.