SVG中特定组或元素的Z阶和Z索引 [英] Z-order and z-index in SVG for particular group or element

查看:114
本文介绍了SVG中特定组或元素的Z阶和Z索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用"path"标记在SVG中绘制了一条线,然后在相同的x值线上绘制了圆,但该圆在该线的后面.我想要圆线在行的前面.如何设置svg中特定组或元素的z-order或z-index以在前面显示该元素.

i drawn one line in SVG using "path" tag and then i drawn circle on the same x value of line but the circle is behind the line. i want the circle element in front of line. how to set z-order or z-index to particular group or element in svg to display the element in front.

我尝试使用z-Index属性进行圆圈绘制,但无法正常工作.

i tried z-Index attribute to circle but its not working .

<circle  .... z-Index=1000>

</circle>

谢谢

Siva

推荐答案

SVG元素没有可调整的z-index.它们的分层顺序取决于您在HTML中绘制它们的顺序.例如,将SVG对象移到顶部是将其从DOM中删除并将其附加到对象的父对象的问题.由于它是最近绘制的SVG对象,因此将显示在顶部.

SVG elements do not have a z-index that you can adjust. Their layering order is dependent on what order you draw them in the HTML. Moving an SVG object to the top, for example, is a matter of removing it from the DOM and appending it to the object's parent. Since it is the most recently drawn SVG object, it will therefore be shown on top.

这篇关于SVG中特定组或元素的Z阶和Z索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆