A solution maybe… Is use a simple counter in the PHP code and asign different classes using echoes in class and stuf,.. there are a lot of ways to do it…
But a pure CSS aproach is use the pseudoclass :nth-child
I do’nt know how toy main loop structure is, but usually is a wrapper div containing another div for every single post.Giving an output like this (or pretty similar)
<div class="wrap">
<div class="single_post_div">
Here goes your post content 1
</div>
<div class="single_post_div">
Here goes your post content 2
</div>
<div class="single_post_div">
Here goes your post content 3
</div>
<div class="single_post_div">
Here goes your post content 4
</div>
<div class="single_post_div">
Here goes your post content 5
</div>
<div class="single_post_div">
Here goes your post content 6
</div>
<div class="single_post_div">
Here goes your post content 7
</div>
</div>
As you see all post hace the same class, no need a single class for everyone or single id (you don’t want select bi ID, you want select by position in loop) there is when you could use :nth-child pseudoclass
.wrap .single_post_div { width:100%; padding:20px 0; }
.wrap .single_post_div:nth-child(1) { background:#9FC; }
.wrap .single_post_div:nth-child(2) { background:#69F; }
.wrap .single_post_div:nth-child(3),
.wrap .single_post_div:nth-child(4) { background:#999; }
.wrap .single_post_div:nth-child(5),
.wrap .single_post_div:nth-child(6),
.wrap .single_post_div:nth-child(7) { background:#aa0; }
This will apply style to the (x) child from parent div (.wrap in the example)
You can see it working in a lil jsfiddle i did.
I like this solution cause yo don’t need mess on PHP or querys…
I hope it be usefull toy you ??