Sarah Haskins
Sarah Haskins

Reputation: 1395

can i use an XHTML div inside an SVG element?

I am attempting to use a div to create a background for an SVG image, but the div is not displaying. I'm not sure if it is legal to mix SVG and XHTML with the XHTML inside the SVG?

Here is a snippet of the HTML...

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:svg="http://www.w3.org/2000/svg"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:v="urn:schemas-microsoft-com:vml">
...
<body>
...
<svg:svg class="searchPoint" height="2048px" id="searchPoint" version="1.1" width="2560px">
    <div lang="" id="mmh_0" dir="ltr" widgetid="mmh_0" class="mmh" 
         style="left: -3px; top: -3px; height: 100px; width: 100px; display: block; z-index: auto;">
    </div>
    <svg:image class="searchPoint" height="15" id="1079043" 
               title="1079043" width="15" x="1183.0" 
               xlink:href="http://myHost/myUri/styles/mapIcons/SearchLocation.gif" 
               xmlns:xlink="http://www.w3.org/1999/xlink" y="1129.0"/>
</svg:svg>
...
</body>
...

For what it is worth, you can put a div inside a VML element in IE.

Upvotes: 2

Views: 5331

Answers (1)

Griffin
Griffin

Reputation: 14634

Yes you can, you need to put it in a foreignObject tag

Upvotes: 3

Related Questions