W3C home > Mailing lists > Public > www-style@w3.org > August 2000

Re: Entities in the Content Property

From: Matthew Brealey <webmaster@richinstyle.com>
Date: Wed, 09 Aug 2000 14:48:23 +0100
Message-ID: <39916127.12E9@richinstyle.com>
To: Andrew n marshall <amarshal@zig.usc.edu>
CC: www-style@w3.org
Andrew n marshall wrote:
> 
> Should entities (like character entities) be expanded if included via the
> content property?  

The answer is no. See, e.g,
http://www.w3.org/TR/REC-CSS2/syndata.html#q24. This is because chracter
references are an HTML concept. CSS is not a dialect of HTML and
therefore does not use its concepts. 

For this, you should use the CSS escape mechanism, unsupported by all
but Mac IE 5 and Mozilla 5.

> For an example of what I am refering to, please see the
> example page:
>   http://sclug.usc.edu/~amarshal/test/content-example.html

Here:

<!--
// Should be this way, but IE doesn't support it.
//  [class~="late"] { color: red; }  
  .quote1:before { content: "&ldquo;"; }
  .quote1:after { content: "&rdquo;"; }

  .quote2 { quotes: "&ldquo;" "&rdquo;" }
  .quote2:before { content: open-quote; }
  .quote2:after { content: close-quote; }
//-->

you should note that // is not a valid CSS comment (although IE accepts
it).

and:

//-->

is not valid CSS. It is valid JavaScript however, where the // (comment)
is used to hide the -->, which the JavaScript interpreter should
otherwise interpret as a pre-increment operator.

Since CSS is not a programming language, there is no need to comment (to
the CSS parser) out the comment (to older HTML UAs, which would
otherwise display the contents).

[Note that CSS does not do named entities; you will have to learn (look
up) the numeric ones.]

-----------------------------------
Please visit http://RichInStyle.com. Featuring:
MySite: customizable styles.         AlwaysWork style 
Browser bug table covering all CSS2 with links to descriptions.
Lists of > 1000 browser bugs         Websafe Colorizer 
CSS2, CSS1 and HTML4 tutorials.      CSS masterclass 
CSS2 test suite: 5000++ tests and 300+ test pages.
Received on Wednesday, 9 August 2000 09:42:26 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:05 GMT