<, >, ≤ and ≥ Symbols – Usage & Meaning

<, >, ≤ And ≥ Symbols

This article explains the meaning of &lt;, &gt;, &le; and &ge; symbols in HTML. Find out why they are used and when you should use them and how.

Meaning

SymbolMeaning
&lt;Less-Than Sign (<)
&gt;Greater-Than Sign (>)
&le;Less-than or Equals sign ( ≤ )
&ge;Greater-than or Equals sign ( ≥ )

Why these symbols are used?

In HTML, the less than or greater than symbols are used to specify the tags as defined below.

<tag-name></tag-name>

But in case, you required to display these symbols in the frontend, using these symbols directly into the webpage content is not a good idea and it may cause display and other HTML errors.

If you’ll try to directly type < or > inside any tag, then HTML markup will try to lookup its closing symbol and in case if it does not find it, it will raise an HTML error.

Observe the following screenshot in which I’ve tried to print the < symbol directly in an H1 Tag.

Less Than Symbol Wrong Use

This is the simplest case and it does not cause an error in the output but as you can see the code editor itself showing code error by highlighting the tags after it in red color. In huge HTML webpages, where there are hundreds and thousands of lines of HTML code, it’ll become really difficult for you to code further if you’ll make use of these symbols directly.

Therefore, it is advised to use the special notations of these symbols. It simply helps to distinguishes between the less than and greater-than sign of the tag brackets and your usage symbols.

How To Use These Symbols?

The usage is simple. Instead of writing <, write &lt; and instead of writing >, write &gt; and similarly for the other two symbols. An example code given below prints all these 4 signs using their special symbols.

<!DOCTYPE html>
<html>
<head>
<title>WTMatter Example</title>
</head>
<body>

<h1> 5 &lt; 10 </h1>
<h2> 10 &gt; 5 </h2>
<h3> 5 &le; 10 </h3>
<h4> 10 &gt; 10 </h4>

</body>
</html>

As you can see in the following screenshot, every sign prints well in the HTML output and also the code editor does not show any error.

Usage Of Lt, Gt, Le And Gt Symbols In HTML

Related Articles.

Leave a Reply

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