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

On Thu, Aug 19, 2010 at 3:08 PM, Tony Schreiner <tonyschr@microsoft.com>wrote:

>
>
The list of CSS properties Jeff referenced are the ones that apply to the
> SVG content itself, but I would argue that when the outermost SVG element is
> embedded in HTML it must behave on equal footing with similar HTML elements.
> Going even further, when embedded in HTML the outermost SVG element should
> also support being directly styled a block or inline block, positioned as
> absolute, relative, or fixed, and so on. None of these styles are in that
> list, and none of these make sense for the SVG content itself, but they do
> make sense on the root SVG container element in HTML.
>
>
>

I actually have no strong opinion one way or another here.  It's just been
my understanding that SVG elements can't be styled with border properties
(for instance).  It seemed a logical conclusion to draw since there is no
box model concept in SVG.  I didn't think about the CSS ramifications of the
fact that an <svg> inline in a HTML context does create a page-aligned box.

My main concern in this matter is the following:  Will it be more confusing
to new authors to say 'SVG elements cannot be styled with a CSS border' or
'SVG elements cannot be styled with a CSS border except for the outermost
<svg> element inline in a HTML context' ?

If the specs are updated for the latter and it's clear to authors in
practice and we don't get fifty emails to www-svg saying "Why can't I have a
CSS border around my <circle>?" then I'm fine either way.  I'll probably
still wrap my <svg>s in a <div> though ;)

Jeff

Received on Saturday, 21 August 2010 19:17:40 UTC