What are HTML entities?


I often see some crazy codes in the middle of tags HTML, and searching falls into this term entities , then the doubts have arisen:

What are Entities HTML and when should I use them?

asked by anonymous 17.01.2017 / 19:55

1 answer


This is a code that represents a character, it starts with & and ends with ; . What goes in the middle is the entity name, the character. We can call named characters .

It is mainly used with escape in characters that can not be easily placed inside HTML. A very typical case is the smallest and largest signal ( < and > ) that are used for tags . Quotes also (% with% and% with%). Obviously the " itself must be represented as an entity. Space is another common since HTML does not consider multiple spaces in sequence as the correct intention and ends up printing only one, thanks to the use of ' to produce the desired result.

Others are used because they do not usually have an easy way to represent them by normal means. Mathematical symbols, accentuation are examples. There was a time when this is very important because the source of the page could be in an encoding that did not allow all possible characters. Today this is rare because it is possible to use Unicode easily, but it is still possible to use it if it is more appropriate.

A complete and official list .

17.01.2017 / 20:06