GM addStyle: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
m (categorized)
(link to @require helper)
 
(36 intermediate revisions by 8 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; }");
 
 
[[Category:API Reference|A]]

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.