4 replies [Last post]
morktron
morktron's picture
Offline
Regular
Ballina, Australia
Last seen: 10 years 26 weeks ago
Ballina, Australia
Timezone: GMT-1
Joined: 2004-01-30
Posts: 21
Points: 0

Hi I've been using CSS for years now but as you can see I'm still having issues Sad...

How do I select the li with the id "current" so that I can style it?

<div class="moduletable-leftmenu">
<h3>About Us Menu</h3>
<ul class="menu">
<li id="current" class="parent active item25">
<a href="/6p/staff">
<span>Staff</span>
</a>
<ul>
</ul>
</li>
<li class="item34">
</li>
</ul>
</div>

Here is the failed css I've tried:

.moduletable-leftmenu ul li #current .active {
	background:#d5bd97;
}

Here is the guilty page: http://www.digiflipconcepts.com/6p/staff

liam.smart
Offline
Enthusiast
Dundee, Scotland
Last seen: 10 years 23 weeks ago
Dundee, Scotland
Joined: 2008-06-26
Posts: 164
Points: 0

.moduletable-leftmenu ul

.moduletable-leftmenu ul li#current.active

Many thanks,
Liam
www.liamsmart.co.uk

morktron
morktron's picture
Offline
Regular
Ballina, Australia
Last seen: 10 years 26 weeks ago
Ballina, Australia
Timezone: GMT-1
Joined: 2004-01-30
Posts: 21
Points: 0

thanks :)

Thanks Liam, that has solved it Smile, although I don't understand why. Many thanks though I appreciate your help, cheers

Mark

liam.smart
Offline
Enthusiast
Dundee, Scotland
Last seen: 10 years 23 weeks ago
Dundee, Scotland
Joined: 2008-06-26
Posts: 164
Points: 0

Well the li has an id of

Well the li has an id of current so really you dont even need the li part. You could have just used '#current.active'.

The class is applied to the li and isnt a self standing class.

Look at the next example:

<li><span class="active"></span></li>

That would need the CSS of 'li .active' since the class has nothing to do with the li.

So if the element has a class, the .class needs to be attached to the element: 'element.class'

I remember struggling with this when I first started CSS. But it will click once you have done it a few times.

Many thanks,
Liam
www.liamsmart.co.uk

morktron
morktron's picture
Offline
Regular
Ballina, Australia
Last seen: 10 years 26 weeks ago
Ballina, Australia
Timezone: GMT-1
Joined: 2004-01-30
Posts: 21
Points: 0

excellent thanks Liam , I

excellent thanks Liam Smile, I shall keep trying to learn and play around with it in the morning, many thanks indeed

Mark