views:

24

answers:

2
A: 

Yes,

GM_addStyle(".myClass { border: 3px dotted green;background-color: red; }");

will create a class style that you can then add via jQuery's .addClass('myClass').

.
Note: you can add more than 1 style with each GM_addStyle statement, too. Like:

GM_addStyle
(
   '.ClearFloats                                            \
    {                                                       \
        clear:              both;                           \
    }                                                       \
    .HideIt                                                 \
    {                                                       \
        display:            none;                           \
    }                                                       \
    .StayOpaque                                             \
    {                                                       \
        opacity:            1 !important;                   \
    }                                                       \
   '
);

etc.

Brock Adams
Thank you, Brock Adams. I didn't know that about adding more than 1 style. You probably saved a lot of my time.
Chookie
+1  A: 
GM_addStyle((<><![CDATA[
    .myClass {
        border: 3px dotted green;
        background-color: red;
    }
]]></>).toString());

This way you don't need to end each line with \

w35l3y
Yes, this is a neat way to add multiple styles.
Brock Adams