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

On 08/23/2010 09:19 AM, Kevin Ar18 wrote:
>  > >> I would just say that the <svg> 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.
>  > >
>  > > Would this apply equally for both referenced SVG and inline SVG?
>  >
>  > Yes. CSS should be handling both exactly the same. (The SVG, given
>  > the additional style information, might behave slightly differently
>  > within its viewport, however.)
>
> To be clear I am referring to the svg element (not object, embed, image,
> etc...)
>
> As far as I can tell, HTML5 does not consider the SVG element to be this
> kind of replaced content:
> http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#replaced-elements

I don't really know what "replaced element" means in HTML, but in
CSS it applies a certain set of rules to the way the element is
handled, and those are exactly the rules we want here. Being a
replaced element in CSS terms has nothing to do with whether the
content is inline or pulled in from an external file: its only
distinction is whether the content of the element is rendered
under the scope of the CSS rendering model or not. (The definition
was worded exactly as it is so that both external SVG and inline
SVG would be considered "replaced elements" in CSS.)

~fantasai

Received on Monday, 23 August 2010 21:41:59 UTC