Would like to avoid CSS styling within my HTML coding

Hi. Once again looking for your help.
I’ve just finished rwd project 4 (Technical documentation) and am still polishing. Basically, I wanted to give my navbar links a different background color. As the are all in a ul as li entries, I coundn’t use the li:nth-child attribute, as that affects all li entries. I couldn’t find any other appropriate CSS selector. Therefore I had to resort to inline CSS within my HTML code (style=), something I find ‘dirty’.
Does anyone have an idea, how I can do it ‘cleanly’?
Here’s the code:

Thanks.

li:nth-child

li:nth-child(1

Hello!

Did you try .ul_article li:nth-child(N)? I think you’re missing the Cascading of the CSS, hehehe.

If you wanted to affect only the direct descendants of .ul_article, then you could write: .ul_article > li:nth-child(N). Take a look at what CSS Specificity is :slight_smile:.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.