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

> 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 UTC