how to alternate background colour in html div elements in css

Solutions on MaxInterview for how to alternate background colour in html div elements in css by the best coders in the world

showing results for - "how to alternate background colour in html div elements in css"
Lois
27 Apr 2018
1/* to color odd children in parent-container with children of type div */
2#parent-container > div:nth-child(odd) {
3 background-color:red;
4}
5
6/* to color even children in parent-container with children of type div */
7#parent-container > div:nth-child(even) {
8 background-color:red;
9}