CSS Select Selector

2020-02-07 02:21发布

问题:

Selecting for buttons works fine:

input[type="submit"]
{
    background:#efefef;
    width:auto;
    padding:5px;
    color:#666;
    font-size:16px;
    font-weight:bold;
    padding:5px 15px;
}

But I can't seem to get anything to work for drop down boxes, this doesn't work:

input[type="select"]
{
    background:#000;
}

Am I selecting it correctly? Can you do it this way?

回答1:

Try this:

select {
    background:#000;
}

As I know, there is no <input type="select" />, just <select></select>.



回答2:

select NOT input[type=select] - browser offer differing capabilities on styling the select element so be patient