DEV Community

Cover image for 10 Mostly used HTML Symbols
Anna
Anna

Posted on • Updated on

10 Mostly used HTML Symbols

Writing the copyright sign in html using entity name as © or using number-code as © to easily display © made sense to me.

Little did I know that empty-space( ), slash sign ( | ), or even a dash ( - ), also hold special code in html. Similarly for a ‘ or an “.

Think about '<' being used as a 'less-than' symbol. HTML would render text after 'less-than' symbol as the beginning of a tag name, thus would create confusion. Bad character error would be avoided if you write:
<p> 4 is &#60; than 3 </p> or:
<p> 4 is &lt; than 3 </p>
instead of: <p> 4 is < than 3 </p>

There is a case where in styling, you would want your web layout to be consistent. Say, a paragraph <p> some text </p> in section-1 has some text, and similar paragraph in section-2 has no text. Instead of living the p tag empty as <p></p>, you could use an empty space symbol (&#32;), and write it in deci-code as:
<p>&#32;</p> or in hex-code as <p>&#x20</p>

Maybe you are using AZERTY keyboard and you don't want to spend your time figuring out where the back-tick is, just use &#96; .

After coding a couple of pages, I made a list for quick referencing the html symbols, their number-code/hex-code and entity code for the ones I have mostly used in basic web-pages. See cover image of this article for the list

I would substitute those characters in the html and use number code, hexadecimal or their entity names instead.

Example on how to use the symbols in code:

<p>wow!</p> to <p>wow&excl;</p>

You can get more of these symbols from W3. There is also a nice table here. Maybe an official one is your preference

Now, you are probably asking what is html-entity. Here is an MDN explanation

Which symbol have you used the most so far, and is not included in this list? Please add in the discussion section below…

Made with love …Anna. ♥ ♥ ♥

Top comments (2)

Collapse
 
daxlooopy profile image
Abdulaziz Sadi

Great read Anna. Thanks for sharing this deep insights about HTML

Collapse
 
buddhadebchhetri profile image
Buddhadeb Chhetri

Wow thanks .