Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法替换加载的 css 文件中的某些值?
例如,我加载了一些 css 文件,但我不知道它的类,但我想将所有包含 #FFFFFF 的值替换为 #000000 并立即在网页上生效。
谢谢!
那么这会做你想要的。将其放在页面顶部的脚本标记中。我不建议将此作为解决方案,因为它会遍历您页面上的所有元素以找出要更改的元素,并更改它找到的元素。
更新了,错过了);在最后。
$(document).ready(function () { $('*').filter(function() { return $(this).css('background-color') == "rgb(255, 255, 255)" }).css('background-color', '#000') });