Win a copy of Java by Comparison (eBook) this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Changing color of item in list  RSS feed

 
Ranch Hand
Posts: 267
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So now I am trying to change the color of the 4th item in my list, but I cant get it to show. I got my first and last item to change color so I dont know why this isnt working....

my CSS:


 
Cody Biggs
Ranch Hand
Posts: 267
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry it would be nth-child(4 )to get to the 4th item?
 
author & internet detective
Marshal
Posts: 37895
594
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Code,
Your CSS is correct. I think the problem is that it doesn't match your HTML.

If I run that CSS with this XML, it displays the colors.


I suspect your HTML has
    though. In which case, you'd need, the CSS to look like this:

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!