Beispiel:SVG-30-foreignObject.html
Aus SELFHTML-Wiki
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
svg {
background: white;
border: thin dotted #337599;
width: calc(100% - 2rem);
height: 350px;
margin: 1rem;
}
</style>
<title>Beispiel: Einbindung von XHTML mit foreignObject</title>
</head>
<body>
<h1>Einbindung von XHTML mit foreignObject</h1>
<svg>
<rect x="10" y="10" width="200" height="150" fill="skyblue"/>
<foreignObject x="20" y="10" width="180" height="170">
<body xmlns="http://www.w3.org/1999/xhtml">
<h2>mehrzeiliger Text</h2>
<p>Dies ist ein Textabsatz mit einem <strong>fetten</strong> Wort und automatischem Zeilenumbruch.</p>
</body>
</foreignObject>
<circle cx="300" cy="200" r="110" fill="gold"/>
<foreignObject x="230" y="120" width="180" height="180">
<h2>Liste</h2>
<ol>
<li>Listenelement</li>
<li>Listenelement</li>
<li>Listenelement</li>
</ol>
</foreignObject>
</svg>
</body>
</html>