A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on IRC (such as one of these permanent autoconfirmed members) or send an e-mail to admin@wiki.whatwg.org with your desired username and an explanation of the first edit you'd like to make. (Do not use this e-mail address for any other inquiries, as they will be ignored or politely declined.)

SVG and (X)HTML

From WHATWG Wiki
Jump to: navigation, search

This document is obsolete.


The way to do vector graphics on the Web is SVG.

Per http://lists.w3.org/Archives/Public/public-html/2007Nov/0487.html there are numerous ways to use SVG together with (X)HTML:

  1. For an SVG document that is an image or animated image, without interaction, embedding in is suitable (this is supported in experimental builds of Opera and Safari).
  2. For an SVG document that is a purely presentational decuration, referencing as a CSS background image is suitable (this is supported in experimental builds of Opera and Safari).
  3. For an SVG document that supports rich interaction (and has more application-like properties) or that requires scripting interaction between the containing HTML document and the SVG, either <object> or <iframe> is suitable. This works today in the latest shipping versions of Safari, Opera and Firefox. <object> even works in IE with a suitable plugin installed.
  4. In XHTML, the <svg> element in the SVG namespace is a suitable way to embed any kind of inline SVG directly in the same document. Many are working on a design to let this work in HTML as well. See this research page.
  5. In both Classic and XML serializations of HTML, SVG content can be dynamically generated by script and inserted into the DOM at runtime, with an svg:svg element as root. This is perhaps closest to the way <canvas> operates. This is supported by Safari, Opera and Firefox and is used by popular JavaScript libraries, such as the Dojo charting toolkit.