HTML and CSS Reference
In-Depth Information
(VML) . VML is a predecessor of SVG , and you've already seen that
SVG and <canvas> can do a lot of similar things. The explorercanvas
library implements <canvas> in IE8 and earlier using VML . Activating
explorercanvas is as simple as including a <script> element in the head
of your HTML document:
<head>
<!--[if IE lte 8]><script src="excanvas.js"></script><![endif]-->
</head>
If you add that to any of the examples
you've seen in this chapter, you
should see them rendering in IE8 as
the screenshot at right.
SVG in XML vs. SVG in HTML
I mentioned earlier that SVG support
isn't as clear-cut as <canvas> support.
This isn't just because the SVG speci-
fication is more complex but also
because there are more ways to use SVG from within a web page. This
is largely because SVG was originally envisioned as one of a family of
XML -based languages that would be used for web content.
In nearly all the major browsers, it has long been possible to embed
SVG content in the XML version of HTML/XHTML . Unfortunately,
there has been one major obstacle to this happening.
Fully compliant XHTML should be delivered from the server as XML
content. The server tells the browser the content type of the file
in the header of the HTTP response. Unfortunately, if you try to
send an XML web page to a version of Internet Explorer earlier
than 9, it refuses to parse the page. Because deploying SVG in XHTML
requires breaking IE, few people have considered it practical.
Embedding SVG as an image
SVG can be used in the <img> element in the same way as any other
image format:
<img src="svg-2.svg">
Search WWH ::




Custom Search