Re: CSS styling compliance question

On Monday, August 30, 2010, 7:34:41 PM, Mark wrote:

M> Looking at the SVG specification, it says styles can be specified
M> using CSS external style sheets or inline using SVG style elements
M> containing CSS in a CDATA section.

Or indeed as the css style attribute.

M> However it's not clear to me if these external style sheets are in
M> fact required to be strictly CSS compliant?

They are required to conform to the grammar of CSS, yes.

M> For instance, look at this example in the SVG spec:-

M> http://www.w3.org/TR/SVG/styling.html#StylingWithCSS

M> It shows an external style sheet thus:-

M> mystyle.css
M> rect {
M>   fill: red;
M>   stroke: blue;
M>   stroke-width: 3
M> }

M> However, all of these properites are not CSS properties but in fact
M> SVG properties. 

SVG exctends the list of CSS properties (which were originally designed for HTML) to add new properties suitable for styling vector graphics.

M> So is this a valid CSS style sheet?  

Yes.

M> Strictly
M> speaking, a CSS parser might reject this as having unknown property
M> names according to CSS2.

A strict CSS 2.1 parser might reject them as not being CSS 2.1 properties, you might think. Except that CSS has no versioning, and is designed to be extensible by adding new properties.

M> Can anybody shed any further light on this issue?  Does the fact the
M> selector is a 'rect' change anything?

No, the selector does not affect the validity of the properties.




-- 
 Chris Lilley   Technical Director, Interaction Domain                 
 W3C Graphics Activity Lead, Fonts Activity Lead
 Co-Chair, W3C Hypertext CG
 Member, CSS, WebFonts, SVG Working Groups

Received on Tuesday, 31 August 2010 12:42:34 UTC