W3C home > Mailing lists > Public > public-cdf@w3.org > January 2006

[WICD] How to create mixed SVG/CSS style sheets

From: Bert Bos <bert@w3.org>
Date: Fri, 13 Jan 2006 17:11:32 +0100
To: public-cdf@w3.org
Message-Id: <200601131711.32302.bert@w3.org>

I think the WICD Core draft is the place for this, at least I don't know 
where else to put it...

There is an unfortunate incompatibility between the syntax of style 
rules for SVG and the syntax defined by CSS. SVG is a Rec and thus 
difficult to change, but the problem only occurs in style sheets that 
mix CSS rules with SVG style rules and it can easily be avoided. I 
think the WICD draft is the place to explain how.

The problem is that SVG allows unitless lengths in various style 
properties (analogous to the way they are allowed in SVG attributes). 
E.g., in an SVG style sheet, you can write

    font-size: 7

which is defined to be the same as

    font-size: 7px

but shorter, and, according to some, more intuitive, because the px in 
SVG has nothing to do with a screen pixel. (In CSS, too, a px isn't the 
same as a screen pixel, but there is usually a simple relation.)

The former notation is not legal in CSS, because numbers are not 
dimensions. (They are used for other things, such as multiplication 
factors.)

Thus, if a WIC document has a style sheet that mixes CSS rules (for the 
XHTML part) and SVG style rules (for the SVG part) in a single style 
sheet, that style sheet must use the latter notation, '7px', instead of 
the former, '7'.

I think a non-normative note is enough. It's not a conformance question: 
CSS defines how to parse numbers, the meaning is just not the same as 
in SVG.



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Friday, 13 January 2006 16:11:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:10:40 GMT