How can I efficiently overwrite CSS with a content script?

后端 未结 2 582
情深已故
情深已故 2021-01-16 07:28

My problem is that I want to overwrite a style of a site. Thing is, there is a way to do this, using the !important sentence, as seen in this example.

H

2条回答
  •  佛祖请我去吃肉
    2021-01-16 08:20

    Maybe it will be faster for you to include all styles from the original CSS that you don't wish to override in your injected stylesheet? If so, you can then remove the original stylesheet from page using content script/code injection or blocking the browser request for CSS file.

    You can also write a small script that does some regex magic and adds !important to every line of given CSS file.

提交回复
热议问题