Edit:
As Hellion pointed out, this is covered by Greasemonkey with GM_addStyle
. From the wiki:
GM_addStyle("body { color: white; } /* CSS etc, etc */");
Greasemonkey is just JS, so you can't directly use CSS in a Greasemonkey script; you need to inject it into the page somehow.
Original Answer:
Demonstrated on http://www.techradar.com/us/news/internet/the-beginner-s-guide-to-greasemonkey-scripting-598247/2, you could add a function to add a stylesheet to the page, then store your CSS in a string:
function addCss(cssString) {
var head = document.getElementsByTagName('head')[0];
var newCss = document.createElement('style');
newCss.type = "text/css";
newCss.innerHTML = cssString;
head.appendChild(newCss);
}
And at some point in your script call addCss
on your current CSS:
addCss("#mainHeader { position:fixed;} /* more CSS here */");