伪元素after,before,css/js控制样式

CSS
<style> body { font: 200%/1.45 charter; } ref::before { content: '\00A7'; letter-spacing: .1em; } </style>
JS
并不能获取到元素因为是伪的假的元素
得还去改变style
document.styleSheets[0].addRule('.red::before','color: green');

http://pankajparashar.com/posts/modify-pseudo-elements-css/

posted @ 2017-03-01 19:12  奔跑的小七  阅读(667)  评论(0编辑  收藏  举报