W3C home > Mailing lists > Public > public-fx@w3.org > July to September 2010

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

From: Kevin Ar18 <kevinar18@hotmail.com>
Date: Mon, 23 Aug 2010 16:49:16 -0400
Message-ID: <SNT110-W22C1C4FE7211D1C0C1C07BAA820@phx.gbl>
To: <fantasai.lists@inkedblade.net>, <schepers@w3.org>
CC: <codedread@gmail.com>, <tonyschr@microsoft.com>, <chris@w3.org>, <public-fx@w3.org>

 
> On 08/21/2010 02:39 PM, Doug Schepers wrote:
> > Hi, folks-
> > ...
> > ==Conclusion==
> > I propose we change SVG 2 to explicitly define this behavior. Hixie
> > seems to imply that this is not for HTML to define, and I tend to agree
> > with that, though maybe some informative mention in the HTML5 or CSS
> > specs for how SVG treats margins and padding might be appropriate.
What did Hixie say exactly?
 
> > I don't think this should be any different in standalone SVG files than
> > in SVG files referenced or inlined in HTML. That would be very
> > unintuitive, in my opinion.
Actually, because it is placed inline in HTML, I think it might be more natural to treat it differently.  A standalone SVG document does not have to contend with the CSS box model; SVG in html does.  It is going to seem very natural for people to want to style the box the svg element is contained in using CSS.
 
Consider the problem with other replaced content, like an image.  An image itself contains no features like border or background-color, yet CSS allows you to style an image with those properties (despited the spec for an image saying there is no such thing as border or background).  The same goes for other embedded or replaced content.  Why should SVG be treated differently? and not be able to have it's container styled with border or background or other CSS properties?  (P.S. I know the problems this causes, but I'm just trying to look at it from another perspecive.)
... and if SVG should be treated differently, then should this not be spelled out in the CSS spec?  Or is all of this why SVG is not called a replaced element in HTML?  ... and what does that really mean for SVG to not be a replaced element?
 
 
 
 
> I would just say that the element is considered a replaced
> element as far as its surrounding contents are concerned, and any
> CSS values set on it apply exactly as if applied to a replaced
> element. And note that in some cases those values may also affect
> the SVG, e.g. 'color' will inherit into the SVG content.
>
> ~fantasai

Are you suggestiong the HTML spec be changed to say that svg is a replaced element?
Currently it is not, which does seem rather odd.  I would be curious to know what this means... why it was specifically chosen not to be a replaced element, etc....
 
BTW, would a replaced element still be a part of the HTML DOM Tree in the same way svg currently is? 		 	   		  
Received on Monday, 23 August 2010 20:49:52 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 August 2010 20:49:53 GMT