40

通过CSS变量修改样式

 5 years ago
source link: https://juejin.im/post/5c3aa7715188252584693163
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
问题: js怎么去修改css伪类样式呢?但是js并没有伪类选择器,那么该怎么办呢?网上有不少方法,比如通过切换元素的类、在style中动态插入新的样式等。 那么这里再来一种方法,设置css变量(var),通过js去改变这个变量来实现。 示例: 改变div的ho

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK