Check out example codes for "html display text in alternating coloured panels". It will help you in understanding the concepts better.

Code Example 1

.altColourElementClass: nth-of-type(odd) {
    background: #e0e0e0;
}

Learn ReactJs, React Native from akashmittal.com