[whatwg] How to use SVG in HTML5?

On Thu, 24 Jan 2008 04:19:37 +1100, Mathieu HENRI <p01 at opera.com> wrote:

> James Graham wrote:
>> David Gerard wrote:
>>> ... I'd like to be able to drop SVG images into
>>> an HTML page as easily as I can a JPEG or PNG. I read over the
>>> recently-released HTML5 draft and couldn't work out how I'd do this.
>>>
>>> What would the HTML to do this look like? What's the equivalent of
>>> <IMG SRC="foo.jpg"> for foo.svg?
>>  In browsers which support it <img src="foo.svg"> will work (with  
>> certain limitations for security reasons). If you want to embed svg  
>> inline like you can with XHTML, that's not currently supported...
>
> Supporting <img src="foo.svg"> is a requirement of SVG 1.1 [1]
...

It is true that you can't use inline markup. As far as I know, <img  
src="foo.svg"> is only supported in Opera 9.5 betas (maybe webkit  
nightlies, I forget). It's also bad HTML, since it lacks any kind of  
fallback.

But you can use <object data-"foo.svg"></object> (again bad HTML, it  
should generally have some kind of fallback content - and a size).  
Unfortunately, of course, IE is still holding you back from doing it on  
the open web that simply :(

cheers

Chaals

-- 
Charles McCathieNevile  Opera Software, Standards Group
     je parle fran?ais -- hablo espa?ol -- jeg l?rer norsk
http://my.opera.com/chaals   Try Opera 9.5: http://snapshot.opera.com

Received on Wednesday, 23 January 2008 12:34:46 UTC