working on it ...

Filters

Explore Public Snippets

Sort by

Found 1 snippet

    public by rfornal  2437  1  6  1

    Simple: Alternate Row Colors (cn be used for ordered list [li], unordered list[li], or tables [using tr]). More correct than nth-of-type which can get dicey when selecting DOM elements. The LI and TR can be switched to almost any HTML tag.

    li:nth-child(even) {
      background-color: red;
    }
    li:nth-child(odd) {
      background-color: white;
    }
    
    tr:nth-child(even) {
      background-color: red;
    }
    tr:nth-child(odd) {
      background-color: white;
    }
    

    List Complete ( 1 snippet total )

    Cannot find what you were looking for?
    Ask the Snip2Code Community

    • Public Snippets
    • Channels Snippets