• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

F. Using SVG with Other XML Applications > Referring to an SVG Document in XHTM...

Referring to an SVG Document in XHTML

This is where things get interesting. First, the <embed> element is deprecated in HTML 4.0, and nonexistent in HTML 4.01 and XHTML. Obviously, this calls for other measures. In place of <embed>, you must use the <object> element. It also needs a height, width, and type, but it uses the data attribute to specify where the SVG document lives. Any content between the opening and closing <object> tags will be displayed if the browser doesn’t support the type of object you’ve specified.

<object data="some_file.svg" width="100" height="200"
    type="image/svg+xml">
    <p>
    Sorry, but your browser doesn't support
    SVG objects. What a pity.
    </p>
</object>

If you use <object>, be aware that it doesn’t work at all in many browsers with version numbers less than 4.0, and is subject to annoying oddities in all but the latest browsers.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint