最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to change CSS-Style with Greasemonkey? - Stack Overflow

programmeradmin1浏览0评论

I'm trying to write a small script for Greasemonkey, but it does not work, because I have little experience.

It is necessary to replace all properties CSS with a value (background: #fff;) on (background: #e8e8e8;).

I'm trying to write a small script for Greasemonkey, but it does not work, because I have little experience.

It is necessary to replace all properties CSS with a value (background: #fff;) on (background: #e8e8e8;).

Share Improve this question edited Aug 31, 2017 at 16:06 Vova Dima asked Aug 31, 2017 at 11:14 Vova DimaVova Dima 111 silver badge2 bronze badges 1
  • 2 To change CSS you use Stylish instead. – user5734311 Commented Aug 31, 2017 at 11:16
Add a ment  | 

2 Answers 2

Reset to default 4
// ==UserScript==
// @name        Background color change
// @namespace   https://website here
// @description Changes the background color
// @version     1
// @grant       none
// ==/UserScript==

document.body.style.background = "white";

Simply add,

GM_addStyle("body { background-color: #fff !
    important; }");

Important may not be needed.

发布评论

评论列表(0)

  1. 暂无评论