Open In App

How to use the HTML reserved character ?

Last Updated : 30 Jan, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

HyperText Markup Language (HTML), the most basic building block of the web page which defines a structure to it. The browser uses this markup language to manipulate data like text, images, and other content to display in the required format.  HyperText refers to the links that connect webpages and markup defines the text document within tags.

HTML reserved characters: In HTML, there are some special characters reserved for use. It means that the browser will parse them as HTML code. These can also be the characters that are not present in the basic keyboard of our devices. For example, < (less than) , > (greater than) , & (ampersand) , ©(copyright) etc.

How to use the HTML reserved characters?

The way we can use HTML reserved characters is using an HTML entity so that reserved characters are not interpreted as HTML code. These entities are strings starting with an ampersand(&) and ending with a semicolon(;). These reserved characters can be used by entity names and entity numbers.

Syntax:

&#entity_number; or &entity_name;

Note: Entity name is case sensitive.

Some entity names and their entity numbers are as follows.

      Reserved Character                Character  Name                Entity Number             Entity Name      
                  <              Less than             &#60;           &lt;
                   &              Ampersand             &#38;          &amp;               
                  ©              Copyright             &#169;          &copy;
                   ∈              Element of             &#8712;             &isin;
                   ∋            Contains as member             &#8715;          &ni;
                   ↓            Downwards arrow             &#8595;           &darr;

Example 1: This example shows the way to use reserved characters such as <(less than), >( greater than), and &(ampersand) using entity names, so they are not interpreted as HTML code.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>HTML reserved character</title>
  
    <style>
        .container {
            background-color: green;
            height: 200px;
            width: 400px;
            font-size: 18px;
            text-align: center;
            color: whitesmoke;
            margin: auto;
        }
    </style>
</head>
  
<body>
    <div class="container">
        <h2> GeeksforGeeks</h2>
        <p>< (Less than) entity name is " &lt; "</p>
  
        <p>> (Greater than) entity name is " &gt; "</p>
  
        <p> & (Ampersand) entity name is " &amp; "</p>
  
    </div>
</body>
</html>


Output : 

Example 2: This example shows the way to use reserved characters such as ←(leftwards arrow), →(rightwards), ↑(upwards), and ↓(downwards arrow) using entity numbers, so they are not interpreted as HTML code.

HTML




<!DOCTYPE html>
<html>
  
<head>
  
    <title>HTML reserved character</title>
    <style>
        .container {
            background-color: green;
            height: 220px;
            width: 430px;
            font-size: 18px;
            text-align: center;
            color: whitesmoke;
            margin: auto;
        }
    </style>
</head>
  
<body>
    <div class="container">
        <h2> GeeksforGeeks</h2>
        <p>← (leftwards arrow) entity number is " &#8592; "</p>
  
        <p>→ (rightwards arrow) entity number is " &#8594; "</p>
  
        <p>↑ (upwards arrow) entity number is " &#8593; "</p>
  
        <p>↓ (downwards arrow) entity number is " &#8595; "</p>
  
    </div>
</body>
</html>


Output: 



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads