简体   繁体   English

如何在CSS中获取DX DY SVG属性

[英]How to grab dx dy svg attribute in css

Can anyone recommend me a best practice method of grabbing dx dy svg attribute in css. 谁能推荐我一个在CSS中获取dx dy svg属性的最佳实践方法。 If this is not possible how do I do it in JS. 如果这不可能,我该如何在JS中做到这一点。

Through js, I would suggest the dom node getAttribute method: 通过js,我建议使用dom节点的getAttribute方法:

 var text = document.querySelector('text') var dx = text.getAttribute('dx') console.log('dx is', dx) 
 <svg> <text dx="20%" x="10%" y="50%">SVG</text> </svg> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM