[whatwg] How to use SVG in HTML5?

Krzysztof Żelechowski giecrilj at stegny.2a.pl
Thu Jan 24 08:41:00 PST 2008


Dnia 24-01-2008, Cz o godzinie 08:50 -0500, Vlad Alexander (xhtml.com)
pisze:
> Embedding SVG by reference (thought the img element) is well suited to HTML. 
> SVG was designed for this as stated in "Embedding by reference" section here:
> 
> http://www.w3.org/TR/SVG11/concepts.html#UsageOptions

This is a permission from SVG's side:
the designer of SVG permits HTML content to use IMG for SVG 
if HTML allows it.  
It should not be viewed as an obligation imposed upon HTML though.  

> 
> I tested Opera's support for SVG through the img element and it incorrectly clips the SVG image. 
> The width and height attributes of the img element 
> need to set the viewport for the SVG image and scale the SVG non-uniformly to fit the viewport.
> 
> The advantages of using the img element to render SVG over the object element or inline SVG are:
> 
> 1. Existing authoring tools and CMS can support SVG without major modifications. 
> For example, 
> most CMS that support image libraries are hard wired to generate the img element 
> when an image is selected from an image library.

They are all wrong (non-compliant).  

There are two ways to embed an image 
for all those Internet Explorer users to view:

1. Ask QuickTime to display the image as an object 
(first time requires administrator privileges)

2. Make it a background image of a suitably sized empty container.  
It is somewhat hard to make the container be displayed in-line 
but images for the sake of themselves rarely need such display.

As a side effect, the right click download is disabled, 
which is something many publishers are after.

> 
> 2. Using SVG through the img element is more accessible solution 
> because existing assistive technologies support the alt attribute 
> whereas support for the object fallback mechanism is limited 

Limited to what?

> and support for inline SVG is non-existent. 

And rightfully so.

> Also, even though SVG supports title and desc elements which are meant to increase accessibility of SVG, 
> most SVG documents do not use them. 
> So having the alt attribute on the img element is more accessible solution 
> than relying on title and desc inside SVG.

I parrot: 
"Most HTML documents do not have it or have some nonsense in it".  
Which of course is no more an argument than yours, i.e. nil.

> 
> Regards,

Chris




More information about the whatwg mailing list