I got the following css:
#navlist li #current
{
color: #000;
background: #FFFFFF;
border-bottom: 1px solid #FFFFFF;
}
I need to change that #current element into a class in order to assign it dynamically to the right li.
How can I translate the code above into a .current with the same result and still applying only to #navlist li elements.
I’m really not good at css and I’m not sure how to write this. (I’ve tried ways without much success)
I’m not sure I understand your question, but the main difference between IDs and classes is that IDs have to be unique in your page. So as long as there is only one element with the
id="current", everything is fine. If you need more than one, change it toclass="current"for all of them.In CSS, you will set properties for the ID with
#current {...}and for the class(es) with.current {...}Hope it helps.
Update:
Depending on your HTML structure, what you need is either
#navlist li.current(for li’s with the class current) or#navlist li .current(for child elements – like a div – of li’s). In this case the CSS will apply ONLY to elements with class current inside the navlist div.