Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to insert Unicode U+2665 in a <h2> HTML?

Tags:

html

unicode

I wanna insert unicode U+2665 in heading of HTML. Thus, I did:

        <h2 id="listas">U+2665 listas</h2>

Unfortunately, this generates the following output when rendered by the browser:

enter image description here

I tried using "and percent" with &U+2665. But it did not work out either.

What should I do to fix this?

Thanks.

like image 532
Pedro Delfino Avatar asked Oct 28 '25 21:10

Pedro Delfino


1 Answers

You can enter any Unicode character using it's hex scalar value in a character entity reference

<h2 id="listas">&#x2665;</h2>

That will display as ♥

The other answers were similar, but require converting the Unicode scalar value to decimal. But you can enter it directly in hex.

like image 76
Peter Constable Avatar answered Oct 31 '25 11:10

Peter Constable



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!