This article explains the meaning of <, >, ≤ and ≥ symbols in HTML. Find out why they are used and when you should use them and how.
|<||Less-Than Sign (<)|
|>||Greater-Than Sign (>)|
|≤||Less-than or Equals sign ( ≤ )|
|≥||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.
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.
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 < and instead of writing >, write > and similarly for the other two symbols. An example code given below prints all these 4 signs using their special symbols.
<h1> 5 < 10 </h1>
<h2> 10 > 5 </h2>
<h3> 5 ≤ 10 </h3>
<h4> 10 > 10 </h4>
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.
- Favicon – What It is, How To Create & Add To Website
- 15 Best Code Editors For Windows, Mac & Linux
- Top 10 Programming Languages