CSS Help: Conditional Styling?

Soldato
Joined
5 Mar 2003
Posts
10,771
Location
Nottingham
Ahoy!
Basically I have to style a third party control and I've come unstuck. I have the following html:
<li class="rmItem rmFirst">
<a class="rmLink rmDisable">
<span class="rmText"></span>
</a>
</li>

Now the rmDisable is optional - it's only there when the control is disabled. The background for the whole item (li) is green. When it's disabled I want it to be grey...

At the moment the css is just:
.rmItem { background-color: green; }

But then I want something like
.rmItem [where child is a.rmDisable] { background-color: grey !important; }

I tried '.rmItem a.rmDisable' but it applies the styling to the inner item, so has the wrong affect on the styling (the inner box is smaller than the outer, so I could see grey and green).

Any help will be much appreciated.
 
Last edited:
Ok thanks for that input guys. As noticed its a third party control so I can't do that. With this in mind I've altered the css so the li css is said applied to li.rmLink instead. This works fine but.....

The first item needs slightly dufferent css than the others. I've altered the css in the first post to show the new optional flag.

How can I specify the css to be used on dual class elements (i.e. if I specify both classes I thought it would give more 'weight' to those options so they override the less specific css?).

I've tried the following:
.RadMenu_Default li.rmItem.rmFirst a.rmLink
{
additional css for a few items that I want to override ones below
}

.RadMenu_Default li.rmItem a.rmLink
{
full css needed for all items
}

But it doesn't seem to work,.

Cheers.
 
Ignore I managed to get it working... the syntax above was ok, just something else was overridding it :)
 
We really don't have the time to do our own controls at the moment so the telerik stuff for the most part saves us a lot of time. Internally we just use their skins so things like the radgrid are amazing... this is the first bit of external facing asp.net work we've had to do so there is a little bit of pain involved :)
 
Back
Top Bottom