0

I have a <p> which has a text containing a '<' sign, and the code editor is giving me this error:

Unexpected token. Did you mean {'>'} or &gt;?

the code is like:

...
<p>
some text some text some text < and some text some text
</p>
...

how can I have this sign '<' in the text inside <p> ?

sima ghoreyshi
  • 379
  • 5
  • 21

2 Answers2

1

You can use &lt; for '<' symbol and &gt; for '>'

Please look at https://www.w3schools.com/html/html_symbols.asp for more details.

Sapna Dhalor
  • 86
  • 1
  • 8
1

If you're trying to display < as text inside html (or jsx that will turn into html), you can't just type special char. Instead, use '&#60;' for '<' and '&#62;' for '>'. For more information check this: https://www.rapidtables.com/web/html/html-codes.html

Pedro Henrique
  • 181
  • 3
  • 11