SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i saw a sharepoint where its list item as a background color (blue) for odd list item number and another (white) for even numbers. I dont know where i can set this.

I looked into designer and i could do it with the ID property and check if the list item is even or odd and then change the background color but the problem is if i do this and they change the way the list is ordered then it will be all messed up. Help anyone ?


share|improve this question
up vote 3 down vote accepted

If you are talking about XSLTListViewWebPart then there should be a class ms-alternating for every second <tr> which you can use to select in CSS, like this:

.ms-itmhover { background-color: darkblue }
.ms-alternating { background-color: darkred }

Another fun way is to use pseudoselects like :not(.ms-alternating) or more fun:

tr:nth-child(odd) { background-color: darkblue }
tr:nth-child(even) { background-color: darkred }

But be aware about browser support.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.