Help! I can't figure out how to style (via CSS) a link class for two of my forum nav links. The link classes are "forum first" and "markasread last." Because there are spaces in the link class names, I'm not sure how to get this to work. I've tried every permutation of "forum first" (forum.first, forum first, forumfirst, etc.) but it's not affecting that link. Just to make sure I was getting at the right place, I styled all the links in that div: #forum .forum-top-links a {color:red} and it worked. I need to affect each individual link though (isn't that the point of having classes, after all?). I've googled and searched drupal to no end and finally decided to just ask. Anyone know the answer? Thanks in advance for your help!

Comments

marcvangend’s picture

Technically speaking, it's not a class name with a space in it, but the element has two classes. If the tag is <a href="#" class="forum first">, the css to match all links with classes 'forum' AND 'first' should be a.forum.first { }.

Note that IE6 does not support multiple classes correctly: it only reads the last class of the css selector. For reference see http://quirksmode.org/css/contents.html#t14 ('mutiple classes'), http://quirksmode.org/css/multipleclasses.html and http://www.ryanbrill.com/archives/multiple-classes-in-ie/.

amandawolfe’s picture

Thank you so much! Oy I looked everywhere for such an answer but the ticket (and keyword) seems to be the multiple part. It makes total sense because it seemed weird for a class name to have spaces when almost nothing else in css can.

Phew. Thanks again! -aw