Embedding HTML in embedded SVG in HTML?

前端 未结 4 742
情歌与酒
情歌与酒 2021-01-05 04:50

It\'s allowed to embed SVG in HTML...



    
        Hmmm....
             


        
4条回答
  •  抹茶落季
    2021-01-05 05:17

    One thing to bear in mind is that the SVG document is discussing XHTML in SVG in an XML document. You are not using XML but HTML. It's a feature of the HTML parser that merges body tags in the way you see.

    If you were using an XML parser, that merging wouldn't happen. To achieve this, you'd need to serve the document with an application/xhtml+xml content type. If you did that, you'd then need to fix other issues like adding a xmlns="http://www.w3.org/1999/xhtml" attribute to your html element.

    It's much easier to follow robertc's advice.

提交回复
热议问题