I have four divs in one page which are styled so that it has four alternating colours. And the even div i.e. 2nd and 4th have an extra class name 'r' like this.
<div class="x-1 liner"><div>
<div class="x-2 liner r"><div>
<div class="x-3 liner"><div>
<div class="x-4 liner r"><div>
The results are pulled from the database, I can use the modulus operator (%) to assign alternating colours for two rows as shown in here but how can I do this for four rows and also add 'r' to the even divs?