Handling of classes with blank in name?

26 views
Skip to first unread message

Ben Stover

unread,
Jul 7, 2013, 2:35:15 AM7/7/13
to Greasemonkey Users
I want to assign soemthing to DIVs with a classnames which contains a blank.
Example. For

<div class="foo bar">
....
</div>

I want to assign in a GM script:

GM_addStyle("div#foo bar { display: none !important; }");

Obviously this doesn't work.

Same with:

GM_addStyle("div#foo div#bar { display: none !important; }");

So how can I assign the "display: none" style otherwiese?

Ben









Zulkarnain K.

unread,
Jul 7, 2013, 5:33:50 AM7/7/13
to Greasemonkey Users, Ben Stover
Looks like you didn't receive my previous email // CCing

On Fri, Jul 5, 2013 at 11:19 PM, I wrote:
>
> For class attribute, use 'period' notation.
>
> p.myp
>
> See http://www.w3.org/TR/css3-selectors/ for reference.
>
>

<element class="foo bar"> means that the element has two classes,
"foo" and "bar".

Use
GM_addStyle("div.foo.bar { display: none !important; }");

Alternatively, you can use attribute selector
GM_addStyle("div[class='foo bar'] { display: none !important; }");


--
Zulkarnain K.
http://userscripts.org/users/12
http://loucypher.github.com/
Reply all
Reply to author
Forward
0 new messages