[thelist] CSS pseudo element :before

Andrew Clover and-evolt at doxdesk.com
Fri Dec 10 04:14:18 CST 2004


Antonio Angelo <antonio.angelo at poste.it> wrote:

> Two questions:
> 1. Do I really need to specify entities or I can use the character itself

Use the character itself, if you are in a CSS file (or in a place where 
HTML/XML escaping rules do not apply, such as an HTML <style> element or 
an XHTML <![CDATA[ section).

Use the escaped character reference if you are in an HTML attribute (ie. 
inline style attribute).

In any case, '>' doesn't actually need to be escaped in HTML. (Except in 
one particularly esoteric case to do with XHTML CDATA sections.)

> 2. How can I specify a numeric entity? (e.g. &#169; or another hard-to-type
> character)?

If the character is in the character set you're using to serve the 
document (eg. ISO-8859-1 for the copyright sign, or UTF-8 assuming 
you've got a Unicode-capable text editor), just type the character. Use 
the Character Map tool or hold AltGr and type 0-1-6-9 on the keypad.

Otherwise, CSS backslash escape sequences are also available, for 
example x:before { content: "\A9 2004"; }. They won't work in IE/Win, 
but then neither will the :before selector.

-- 
Andrew Clover
mailto:and at doxdesk.com
http://www.doxdesk.com/


More information about the thelist mailing list