GM addStyle: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
m title underscore template
link to @require helper
 
(37 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{underscore|title=GM_addStyle}}
{{DISPLAYTITLE:GM_addStyle}}  


= Syntax =
As of Greasemonkey 4.0, this method has been removed.


'''GM_addStyle(''' ''css'' ''')'''
You can `@require` a helper script to provide the same functionality, for example [https://gist.github.com/arantius/eec890c9ce4ff2f7abee896c0bba664d gm-addstyle.js].
 
= Description =
 
Adds a string of CSS to the document.
 
Creates a new <code><style></code> element, adds the given CSS to it, and inserts it into the <code><head></code>.
 
= Examples =
 
GM_addStyle("body { color:red; }");

Latest revision as of 15:12, 8 November 2023


As of Greasemonkey 4.0, this method has been removed.

You can `@require` a helper script to provide the same functionality, for example gm-addstyle.js.