开发者

Will browsers render namespaced HTML inside SVG XML?

开发者 https://www.devze.com 2023-02-10 14:04 出处:网络
I would like to insert name开发者_如何学Gospaced (X)HTML inside SVG. The XHTML DOM nodes exist, I can script them, but the don\'t seem to render. Is there a way to achieve this?

I would like to insert name开发者_如何学Gospaced (X)HTML inside SVG. The XHTML DOM nodes exist, I can script them, but the don't seem to render. Is there a way to achieve this?

I need it mainly as a workaround for line-wrapping of text that is AFAIK missing in SVG (see my question Auto line-wrapping in SVG text)


Using <foreignObject> is the answer. http://starkravingfinkle.org/blog/2007/07/firefox-3-svg-foreignobject/


If you want wider compatibility, go for (x)html as the main document (most script libraries don't support being used directly from SVG documents, jQuery is one example) and include svg either inline or via <object> depending on what you need to do.

0

精彩评论

暂无评论...
验证码 换一张
取 消