Tuesday, 16 April 2013

CSS: Alternate Row Style


Alternate color for Table row:
tr:nth-child(odd) { background:#000; }
tr:nth-child(even) { background:#333; }

Alternate color for List
ul > li:nth-child(odd) { background-color:#eee; }
ul > li:nth-child(even) { background-color:#fff; }

Alternate Color for ASP.NET DropDownList:
#myForm select {
            background:green;
            color:orange;
        }

#myForm select option:nth-child(odd) {
            color:black;
            background:yellow;
        }
        #myForm select option:nth-child(even) {
            color:white;
            background:blue;
        }
       
Alternate color for ASP.NET DropDownList:
select
{
    padding-left: 10px;
    font-family: 'Trebuchet MS';
    font-size: 12px;
    color: #000066;
}

select option:nth-child(odd)
{
    background: #CCCCCC;
}

select option:nth-child(even)
{
    background:lime;   
}

No comments:

Post a Comment