我尝试动态更改在 CSS 中定义的元素的位置:after。使用这个:
$(function(){
$('div::after').css({'top':'20px'})
})
但它不起作用。有没有办法改变位置?
我尝试动态更改在 CSS 中定义的元素的位置:after。使用这个:
$(function(){
$('div::after').css({'top':'20px'})
})
但它不起作用。有没有办法改变位置?
添加CSS:
p.special:before {
content: "bar";
position: absolute;
top : 10px;
}
假设放置上面代码的样式表是页面上的第一个,使用它来更改它:
document.styleSheets[0].addRule('p.special:before','top: 15px;');