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: 



Similar Reads

JavaScript | Reserved Words
In JavaScript, you cannot use these reserved words as variable names, label names, or function names. Reserved Words: abstractargumentsbooleanbreakbytecasecatchcharconstcontinuedebuggerdefaultdeletedodoubleelseevalfalsefinalfinallyfloatforfunctiongotoifimplementsininstanceofintinterfacelongnativenewnullpackageprivateprotectedpublicreturnshortstatic
1 min read
JavaScript SyntaxError "variable" is a reserved identifier
This JavaScript exception variable is a reserved identifier occurs if the reserved keywords are used as identifiers. Message: SyntaxError: The use of a future reserved word for an identifier is invalid (Edge) SyntaxError: "x" is a reserved identifier (Firefox) SyntaxError: Unexpected reserved word (Chrome) Error Type: SyntaxError What happened? Whe
1 min read
When to use interfaces and when to use classes in TypeScript ?
TypeScript supports object-oriented programming features like classes and interfaces etc. classes are the skeletons for the object. it encapsulates the data which is used in objects. Interfaces are just like types for classes in TypeScript. It is used for type checking. It only contains the declaration of members of the object. It helps in deriving
4 min read
How to select html element using ID in jQuery when ID contains a dot character ?
The task is to select an HTML element/node by ID using jQuery when the ID itself contains a DOT (' . '). Not only dots(.) there are so many other meta character such as ! " # $ % & ' ( ) * + , . / : ; ? @ [ \ ] ^ ` { | } ~ can be selected by this procedure. Syntax: $('#ID_PREFIX\\.ID_SUFFIX') Approach: In order to select an HTML element by ID we ju
2 min read
How to select id that contains Meta Character in HTML ?
Introduction: In the programming, a lot of times we have seen Metacharacter, before going on the main topic let's have brief info about Meta characters. These are the special characters available in the programming that has special meaning. There are several meta characters some of them are listed below: Example: / $ [ ] { } | * Approach: Suppose w
3 min read
What is character entities in HTML ?
In this article, we will learn about HTML character entities and how to use them. HTML character entities are basically a set of characters (entity) used to represent few characters reserved by the HTML, especially invisible characters or characters difficult to type out using a regular keyboard. HTML provides some entity names and entity numbers t
2 min read
How to indicate character set being used by a document in HTML ?
For web browser to understand the set of characters used in the HTML document, various HTML encoding character set representations has been used like ASCII, ISO-8859-1, UTF-8 etc. The character set being used by an HTML document is indicated using the charset attribute of a &lt;meta&gt; tag inside the &lt;head&gt; element of the HTML. In HTML4, ISO
2 min read
Explain different kinds of character set available in HTML
Explain the different kinds of character sets available in HTML? Before looking at different kinds of character sets available in HTML, let us first know what character sets in HTML actually are. HTML Character Sets: Have you ever wondered how the browser displays the numbers, alphabets, and other symbols precisely? It is possible with the help of
4 min read
How to fix “No character encoding declared at document level” in HTML Document ?
This article intends to solve the “No character encoding declared at document level” issue in your HTML program. So, before getting to the solution, we need to understand what this issue means. And for that first, we need to know about character encoding in HTML. What is character encoding in HTML? Character encoding is a system used to represent c
5 min read
Create a Character Limit Textarea using HTML CSS and JavaScript
In this article, we will create a Character Limit Textarea using HTML, CSS, and JavaScript. In this application, we will display the text area as an input component to the user and there is a predefined limit set to accept the input. When the limit is been crossed the user will get the alert message and he will not be able to type further in the te
6 min read