Can I embed HTML into an HTML5 SVG fragment?

后端 未结 3 1011
抹茶落季
抹茶落季 2020-12-07 20:15

HTML5 supports the tag, allowing to embed SVG into HTML.

Digging a little deeper, can I nest some HTML inside my fr

3条回答
  •  我在风中等你
    2020-12-07 20:55

    Copied from bl.ocks.org (thank you, Janu Verma)

    
    
    
        
        HTML inside SVG
        
        
            
    I'm a div inside the HTML
    I'm a div inside a SVG.
    Interesting! But you a Foreign Object.

    UPDATE

    Note that there is a 'camel error' in the above - it's supposed to be foreignObject (capital O), not foreignobject. It doesn't matter if the misspelling is in 'straight' HTML/SVG. But if you use JavaScript (.createElementNS), then it won't work without proper camel case (April 2020)

提交回复
热议问题