RE: How does the svg element handle CSS border and background-color?

On Thu, 19 Aug 2010, Tony Schreiner wrote:
>
> I strongly disagree with Jeff's interpretation of the spec. I have yet 
> to find the behavior clearly spelled out in any combination of specs but 
> the HTML5 spec says the following:
> 
> "The svg element from the SVG namespace falls into the embedded content, 
> phrasing content, and flow content categories for the purposes of the 
> content models in this specification."
> 
> Between this, working with our own CSS experts, and working from first 
> principles with the long-term future of SVG in mind, I've understood 
> this to mean that when an <svg> element is embedded in HTML5 or XHTML, 
> that outermost element does participate in the box model, and as such 
> CSS formatting such as backgrounds, borders, margin, and padding should 
> apply to that outermost SVG element, just like it would to a <div>, 
> <img>, <iframe> or any similar element.

The line you cite does not mean that. All it means is that for the 
purposes of document conformance -- something that only affects authors, 
validators, and editors (including contenteditable implementations), but 
does not affect in any way CSS rendering rules or parsing or anything like 
that -- the <svg> element falls into certain content model categories.

You should never need to read between the lines in the HTML spec; I've 
tried to make everything very explicit.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Saturday, 21 August 2010 18:22:39 UTC