2017-08-31 99 views
0

我正在嘗試爲Greasemonkey寫一個小腳本,但它不起作用,因爲我沒有什麼經驗。如何使用Greasemonkey更改CSS樣式?

需要用(背景:#e8e8e8;)上的值(background:#fff;)替換所有屬性CSS。

+2

要改變你使用Stylish的CSS代替。 –

回答

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

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

只需添加,

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

重要的可能並不需要。

+1

「從Greasemonkey 4.0開始,此方法已被刪除。」 (https://wiki.greasespot.net/GM_addStyle) –