The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS CSS NTH Child Property Help

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #273012

    I am looking to design a block of 30 div which consist of 4 different colour and should be repeat using a same CSS. I have tried couple of different methods and found CSS NTH child to be most efficient among all.

    But I am facing an issue while declaring it on every 4 block because I am using WordPress managed hosting so my website is on staging URL.

    I am not sure whether it should be done through CSS or should I use Javascript.

    I have followed W3School NTHChild Resource

    p:nth-child(odd) {
        background: red;
    p:nth-child(even) {
        background: blue;

    Take a look at this explanation:
    And see an example here:

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘CSS’ is closed to new topics and replies.