Certain characters are reserved in HTML.
If you incorporate the less than (<) or greater than (>) signs in your HTML content, they might be confused with tags by the browser.
To avoid this, entity names or entity numbers can be utilized to represent reserved HTML characters.
Entity names are structured as follows:
&entity_name; |
Entity numbers are represented in this format:
&#entity_number; |
To display a less than sign (<), we must write it as < or as <.
Entity names are simpler to recall compared to entity numbers. |
A frequently utilized HTML entity is the non-breaking space:
A non-breaking space functions as a space that remains intact without causing a line break.
When two words are separated by a non-breaking space, they remain together without breaking onto a new line. This is particularly useful when separating the words might disrupt the flow of content.
Examples:
Another common application of the non-breaking space is to prevent browsers from trimming spaces in HTML pages.
For instance, if you include 10 spaces in your text, the browser will eliminate 9 of them. To retain actual spaces in your text, you can utilize the character entity.
The non-breaking hyphen (‑) is employed to designate a hyphen character (‑) that does not cause a line break.
Result |
Description |
Name |
Number |
non-breaking space |
|
|
|
< |
less than |
< |
< |
> |
greater than |
> |
> |
& |
ampersand |
& |
& |
“ |
double quotation mark |
" |
" |
‘ |
single quotation mark |
' |
' |
¢ |
cent |
¢ |
¢ |
£ |
pound |
£ |
£ |
¥ |
yen |
¥ |
¥ |
€ |
euro |
€ |
€ |
© |
copyright |
© |
© |
® |
trademark |
® |
® |
A diacritical mark is a “glyph” attached to a letter.
Certain diacritical marks, such as grave ( ̀) and acute ( ́), are referred to as accents.
Diacritical marks can be combined with alphanumeric characters to generate a character not initially available in the character set (encoding) utilized on the page.
Below are a few examples:
Mark |
Character |
Construct |
Result |
̀ |
a |
à |
à |
́ |
a |
á |
á |
̂ |
a |
â |
â |
̃ |
a |
ã |
ã |
̀ |
O |
Ò |
Ò |
́ |
O |
Ó |
Ó |
̂ |
O |
Ô |
Ô |
̃ |
O |
Õ |
Õ |