
求教一个SVG的问题,请大神赐教
是这样,在css中呢,我们使用z-index来进行堆叠定位,但在svg元素中,不知道是不是没有直接属性进行堆叠定位。我用了强制为其赋css的方法,但我的z-index完全...
是这样,在css中呢,我们使用z-index来进行堆叠定位,但在svg元素中,不知道是不是没有直接属性进行堆叠定位。我用了强制为其赋css的方法,但我的z-index完全起不到效果。我查找元素后发现一个规律,后面创建的元素会叠在前面的元素上面。尝试了还能多种方法都无果。所以想请高手们指点迷津。找出一个可行的解决方案。我的实例是一个圆(circle元素)和一条曲线(path元素)我想让path元素叠在圆的下方。并且path元素一定是后面创建的。先感谢大家了!
展开
1个回答
展开全部
有没有指定这些元素的position样式,z-index要起作用,这个元素一定要设置position样式。
基本上不想改变元素的位置,就用position:relative;就可以。这样z-index就可以起作用了
基本上不想改变元素的位置,就用position:relative;就可以。这样z-index就可以起作用了
更多追问追答
追问
SVG的元素都是默认绝对定位absolute的。按理说应该是可以使z-index起作用才对。我试试再指定一个样式。没有效果!
追答
好像svg文档里有说怎么用
网址 http://dev.w3.org/SVG/modules/streaming/
你搜索下z-index,下面是我找到的那部分
One potential problem with this guideline is when the rendering order according to the document order differs from the time order. This is for instance the case if object A needs to be rendered in front of B but is rendered before B. Authors may use the z-index property; a combination ofuse elements and animation elements to change the visual order between A and B; or scripting to change the document order between A and B at a given time.
EXAMPLE 3: Using animations and use elements to change the rendering order compared to the document order

2023-05-10 广告
您好!建议咨 深圳市微测检测有限公司,已建立起十余个专业实验室,企业通过微测检测就可以获得一站式的测试与认 证解决方案;(EMC、RF、MFi、BQB、QI、USB、安全、锂电池、快充、汽车电子EMC、汽车手机互 联、语音通话质量),认证遇...
点击进入详情页
本回答由微测检测5.10提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询