我应该添加什么,以便我的<select>看起来像一个选择?</select>

时间:2014-04-01 16:38:30

标签: html css

我正在使用按钮库。

我将这种风格应用于<select>并且工作正常。但它有一个按钮而不是选择。

我想在右边添加▾,使其类似于普通选择。

所以我的假设是我应该做点什么:

select.button {
    /* some style here */
}

我的选择是

<select class="button is-default">
    <option>1</option>
    <option>2</option>
    <option>3</option>
</select>

CSS:

.button {
    text-rendering: optimizeLegibility;
    -webkit-appearance: none;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-select: none;
    user-select: none;
    position: relative;
    display: inline-block;
    box-sizing: border-box;
    margin: 0;
    padding: 1px 4px;
    border: 1px solid transparent;
    border-radius: 2px;
    background-color: transparent;
    color: inherit;
    vertical-align: middle;
    text-align: center;
    text-decoration: none;
    text-transform: none;
    white-space: normal;
    font-weight: 400;
    font-style: normal;
    font-size: 13px;
    font-family: "OpenSansSemiBold",Helvetica,Arial,sans-serif;
    line-height: 20px;
    cursor: pointer;
    -moz-transition: all .15s ease;
    -o-transition: all .15s ease;
    -webkit-transition: all .15s ease;
    transition: all .15s ease;
}
.button:hover, .button:focus {
    outline: 0;
    text-decoration: none;
}

.button:active, .button.is-active {
    -webkit-box-shadow: none;
    box-shadow: none;
    text-decoration: none;
}

.button[disabled], .button.is-disabled {
    opacity: .7;
    filter: alpha(opacity=70);
    cursor: not-allowed;
    pointer-events: none;
}

.button.is-default {
    border-color: #656d78;
    background-color: #f5f7fa;
    color: #434a54;
}

.button.is-default:hover, .button.is-default:focus {
    border-color: #737c89;
    background-color: #fff;
}

这里是JSFiddle

1 个答案:

答案 0 :(得分:2)

删除行-webkit-appearance: none;,您将返回箭头。至少在谷歌浏览器中。