Wayners247
Wayners247

Reputation: 455

correct method for an id within a class?

I have a navigation system. CSS based. On a few of the li items I need to be able to customize the way it looks (background colour, font colour etc).

At the moment the top level menu is here: http://www.gardensandhomesdirect.co.uk/menutest

SALE, the bottom menu, is one I am trying to set as having a red background and have tried doing it this way:

.side_nav .li-sale { background-color:#900 !important; color:#FFF !important; }

However it is getting overuled.

What is the best way to set this up? So I can have custom li classes used.

Upvotes: 1

Views: 1617

Answers (2)

Māris Kiseļovs
Māris Kiseļovs

Reputation: 17285

That's because your red background color is for LI which is under green A, so you cannot see that LI.

Just try setting style for child A element:

.side_nav ul li.li-sale a { 
    background-color:#900;
    color:#FFF; 
}

Upvotes: 3

Michiel
Michiel

Reputation: 8083

If you li's are something like this:
<li class="side_nav" id="li-scale">

you can call this one in your css with:
.side_nav #li-scale

So basically, in your css, you call classes with a . and you call id's with a #

Upvotes: 0

Related Questions