即使元素具有在CSS中设置的值,也获取内联样式值? [英] Get inline-style value even if element has the value also set in CSS?
本文介绍了即使元素具有在CSS中设置的值,也获取内联样式值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果您有以下元素:
<span style="width:100px"></span>
且css为:
span {width:50px!important;}
有没有办法我可以获得内联样式值并忽略css值吗?
Is there a way I can get the inline-style value and ignore the css value?
谢谢
推荐答案
使用 element.style.width
样本:
$(function(){
alert($("span")[0].style.width);
});
这篇关于即使元素具有在CSS中设置的值,也获取内联样式值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文