HTML in SVG in HTML

后端 未结 1 2046
悲&欢浪女
悲&欢浪女 2020-12-08 09:34

I have a simple SVG file which views fine in Firefox - its some wrapped text in a box using a foreignObject to include some HTML - the text is wrapped in the div:

         


        
相关标签:
1条回答
  • 2020-12-08 10:22

    This works fine for me:

    <!DOCTYPE html>
    <html>
    <head>
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <title>HTML in SVG in HTML</title>
      <style type='text/css'>
        svg { border: 1px solid black; }
        svg div { border: 1px dotted blue; }
      </style>
    </head>
    <body>
    <svg xmlns="http://www.w3.org/2000/svg" width="800" height="500">
      <foreignObject class="node" x="46" y="22" width="200" height="300">
        <body xmlns="http://www.w3.org/1999/xhtml">
          <div>The quick brown fox jumps over the lazy dog. Pack my box with
             five dozen liquor jugs</div>
        </body>
      </foreignObject>
    </svg>
    </body>
    </html>
    
    0 讨论(0)
提交回复
热议问题