HTML Tutorial
HTML - Introduction HTML - Basic HTML - Structure HTML - Element HTML - Attributes HTML - Headings HTML - Paragraphs HTML - Styles HTML - Formatting HTML - Phrase Tags HTML - Quotations HTML - Comments HTML - Colors HTML - CSS HTML - Links HTML - Images HTML - Tables HTML - List HTML - Inline elements HTML - Block elements HTML - Classes HTML - Id HTML - Javascript HTML - File Path HTML - Iframe HTML - Responsive HTML - Computer Code HTML - Head tag HTML - Events HTML - Url Encoding HTML - Entities HTML - Validation
HTML Forms
HTML - Forms HTML - Form Elements HTML - Input types HTML - Input Attributes
HTML5
HTML5 - Introduction HTML5 - New Elements HTML5 - Semantics HTML5 - Style Guide
HTML Media
HTML - Video HTML - Audio HTML - Embed Multimedia
HTML Graphics
HTML - Canvas HTML - SVG
HTML APIs
HTML - Geolocation HTML - Drag & drop HTML - Web Storage HTML - Web Workers
HTML References
HTML - Tag Reference HTML - Tag by Category HTML - Attributes HTML - Global Attributes HTML - Events HTML - Language Codes HTML - Country Codes HTML - URL Encoding HTTP Methods HTTP Status Codes <input> types

HTML Entities

Few characters are reserved in HTML and they have special meaning when used in HTML document.

For example if you use the less than (<) or greater than (>) signs in your text, the browser will mix them with tags.

Character entities are used to display reserved characters in HTML.

A character entity looks like this:

&entity_name;

OR

&#entity_number;

To display a less than sign (<) we must write: &lt; or &#60;

To display a grater than sign (>) we must write: &gt; or &#62;

To display character entities in your document you can either use entity name or entity number.


HTML Non-breaking Space

A non-breaking space is a space that will not break into a new line.

Common use of the non-breaking space is to prevent browsers from truncating spaces in HTML pages.

The &nbsp; character entity allows you to create multiple spaces that are visible on a web page.

Run code

With the above examples using &nbsp; would allow you to create multiple spaces in a row, something that cannot be done by only pressing the spacebar.


Useful HTML Character Entities

An HTML entity begins with the ampersand (&) character and ends with the semicolon (;) character.

Character Entity name Entity number
<space> &nbsp; &#160;
< &lt; &#60;
> &lt; &#62;
& &amp; &#38;
" &quot; &#34;
' &apos; &#39;
© &copy; &#169;
® &reg; &#174;
&hearts; &#9829;