• Tutorial List

HTML Entities

Last updated Jul 08, 2020

What are HTML Entities?

An HTML entity is a piece of text that represents a special character, such as – §, ©, ‱, «, etc

Use of the HTML Entities

HTML Entities are used to display reserved characters in HTML such as <, >, &, etc. And it is also used to write those characters that are difficult to type in a standard keyboard such as ©, ®, , etc.

How to write HTML Entities?

An HTML entity starts with an ampersand (&) and ends with a semicolon (;). Like – &nbps; &lt; &gt;

The following ways you can write the HTML entites –

  1. &entity_name;
  2. &#entity_number;
  3. &#xhex_code;
  • The < less than entity –
    • Name is – lt
    • Number is – 60
    • Hex Code is – 3C
<!DOCTYPE html>
  <meta charset="UTF-8">  
  <title>HTML Entity Example</title>
  <h2>Less than Entity</h2>
&lt; Entity Name
&#60; Entity Number
&#x3c; Entity Hex Code

Some useful HTML Entities

ResultEntity NameEntity NumberDescription
&nbsp;&#160;non-breaking space
<&lt;&#60;less than
>&gt;&#62;greater than
&quot;&#34;quotation mark

Non-breaking Space &nbsp;

The non-breaking space looks like space, but it is a character, that’s why it won’t break into a new line.

/* CSS for span text */
<!-- Without non-breaking space -->
Lorem ipsum dolor sit amet consectetur adipisicing. <span>Hello World</span>
<!-- With non-breaking space -->
Lorem ipsum dolor sit amet consectetur adipisicing. <span>Hello&nbps;World</span>


Without non-breaking space

example of Without html non-breaking space
Without non-breaking space

With non-breaking space

Example of With HTML non-breaking space
with non-breaking spce

Ask Questions

Your email address will not be published. Required fields are marked *