Css – How to change asp:DropDownList extended background color ? CSS class

asp.netbackground-colorcssdrop-down-menu

Here the class and the example

    <asp:DropDownList ID="dropDownListZenithYesNo" 
    CssClass="dropDownBox" runat="server"></asp:DropDownList>

And here the CSS class of that dropdownlist

.dropDownBox
{
    font-size: 13px;
    color: #3b3b3b;
    padding: 5px;
    background: -moz-linear-gradient(
    top,
    #f0f0f0 0%,
    #d6d6d6);
    background: -webkit-gradient(
    linear, left top, left bottom, 
    from(#f0f0f0),
    to(#d6d6d6));
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 3px;
    border: 1px solid #999999;
    -moz-box-shadow: 0px 1px 2px rgba(000,000,000,0.5), inset 0px 1px 0px rgba(255,255,255,1);
    -webkit-box-shadow: 0px 1px 2px rgba(000,000,000,0.5), inset 0px 1px 0px rgba(255,255,255,1); 
    box-shadow: 0px 1px 2px rgba(000,000,000,0.5), inset 0px 1px 0px rgba(255,255,255,1);
     text-shadow: 0px 1px 0px rgba(255,255,255,1), 0px 1px 0px rgba(255,255,255,0);
}

And here how it looks nice when you not click to see elements

enter image description here

And this is how very bad it looks when you click to see elements

enter image description here

Testing with windows 7 firefox latest version

CSS CSS3 HTML dropdown list color style

Best Answer

Add the following css below your css

.dropDownBox option
    {
        font-size: 13px;
        color: #3b3b3b;
        padding: 5px;
        background: -moz-linear-gradient(
top,
#f0f0f0 0%,
#d6d6d6);
        background: -webkit-gradient(
linear, left top, left bottom, 
from(#f0f0f0),
to(#d6d6d6));
        -moz-border-radius: 3px;
        -webkit-border-radius: 3px;
        border-radius: 3px;
        border: 1px solid #999999;
        -moz-box-shadow: 0px 1px 2px rgba(000,000,000,0.5), inset 0px 1px 0px rgba(255,255,255,1);
        -webkit-box-shadow: 0px 1px 2px rgba(000,000,000,0.5), inset 0px 1px 0px rgba(255,255,255,1);
        box-shadow: 0px 1px 2px rgba(000,000,000,0.5), inset 0px 1px 0px rgba(255,255,255,1);
        text-shadow: 0px 1px 0px rgba(255,255,255,1), 0px 1px 0px rgba(255,255,255,0);
    }

But test your page in multiple browsers because it may have different results. Infact i have different results.