JavaScript - Is there a way how to draw SVG path UNDER the content?

别等时光非礼了梦想. 提交于 2019-12-12 04:35:41

问题


I need a path that goes UNDER the content (text) - is there a way how to do that?

(as already been answered somewhere else, z-index doesnt affect svg paths)


回答1:


You can declare PATH and TEXT in different SVG layers, and put one layer onto another like this

<svg xmlns="http://www.w3.org/2000/svg" version="1.1" style="position:absolute;z-index:1">
  <text x="100" y="15" fill="red">I love SVG</text>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" style="position:absolute;z-index:0">
  <path d="M150 0 L75 200 L225 200 Z" />
</svg>

http://jsfiddle.net/WJZrU/



来源:https://stackoverflow.com/questions/19265746/javascript-is-there-a-way-how-to-draw-svg-path-under-the-content

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!