The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

[Solved] Applying Two Classes

  • # December 25, 2009 at 3:58 pm

    Hi Guys

    On my website, I want a button to stay lit up when that particular page it is linking to it the viewed one. Here is a screenshot of what a button is like usually:


    But when I go to the portfolio page .. I want that button to light up like so:


    I have applied two classes to the anchor tag .. but it is not working .. I don’t know why !! Can someone please help :(

    Thank You.

    # December 25, 2009 at 4:37 pm

    Well, when you need to give an element two classes, you list it like so (no commas between classes):

    "class1 class2"

    And also, in your CSS, if you use "#header ul li a.current" rather than just ".current", that should fix it. Basically, that makes that particular statement more important, so it doesn’t get overwritten by other CSS statements. See … ould-know/ for more info.

    # December 25, 2009 at 5:04 pm


    Falken my friend you are a genius.

    On my local machine I had removed that comma but like you said it got overwritten.

    But now it is working fine with [ #header ul li a.current ] !!

    Thank You Soo Much :D

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed