Adding HTML entities using CSS content
How do you use the CSS content
property to add html entities?
Using something like this just prints
to the screen instead of the non-breaking space:
.breadcrumbs a:before {
content: ' ';
}
You have to use the escaped unicode :
Like
.breadcrumbs a:before {
content: ' 000a0';
}
More info on : http://www.evotech.net/blog/2007/04/named-html-entities-in-numeric-order/
CSS is not HTML.
is a named character reference in HTML; equivalent to the decimal numeric character reference  
. 160 is the decimal code point of the NO-BREAK SPACE
character in Unicode (or UCS-2; see the HTML 4.01 Specification). The hexadecimal representation of that code point is U+00A0 (160 = 10 × 161 + 0 × 160). You will find that in the Unicode Code Charts and Character Database.
In CSS you need to use a Unicode escape sequence for such characters, which is based on the hexadecimal value of the code point of a character. So you need to write
.breadcrumbs a:before {
content: 'a0';
}
This works as long as the escape sequence comes last in a string value. If characters follow, there are two ways to avoid misinterpretation:
a) (mentioned by others) Use exactly six hexadecimal digits for the escape sequence:
.breadcrumbs a:before {
content: ' 000a0foo';
}
b) Add one white-space (eg, space) character after the escape sequence:
.breadcrumbs a:before {
content: 'a0 foo';
}
(Since f
is a hexadecimal digit, a0f
would otherwise mean GURMUKHI LETTER EE
here, or ਏ if you have a suitable font.)
The delimiting white-space will be ignored, and this will be displayed foo
, where the displayed space here would be a NO-BREAK SPACE
character.
The white-space approach ( 'a0 foo'
) has the following advantages over the six-digit approach ( '