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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

Bert Bos

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
  [hidden email]                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France