Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I put "< >" as a text in HTML? [duplicate]

Tags:

html

css

I would like to include < and > inside of a text in HTML but I'm unable to because HTML doesn't understand that it's text.

Is there any way to put those symbols in HTML as a text and make the editor understand it ?

Example:

<div> <this is some text> </div>
like image 592
Zack Roberto Avatar asked Apr 17 '18 11:04

Zack Roberto


1 Answers

Yes, simple use &lt; and &gt; like this:

Use then &lt;like&gt; this

<br>
  
5 &lt; 6 = true

<br>
  
1 &gt; 2 = false

Your Example would be:

<div>&lt;this is some text&gt;</div>

They are called HTML Entity's:

An HTML entity is a piece of text ("string") that begins with an ampersand (&) and ends with a semicolon (;) . Entities are frequently used to display reserved characters (which would otherwise be interpreted as HTML code), and invisible characters (like non-breaking spaces)

You can check the full entity's list in W3 Org and learn more about it in the MDN Documentation

like image 168
Matheus Cuba Avatar answered Oct 23 '22 21:10

Matheus Cuba