jquery - 使用 css 下拉选择屏幕出现错误

标签 jquery html css

我尝试制作 css 选择框,但是当我尝试使用 firefox 时,我变得不同了。但是choroe很好。我需要在 CSS 后面添加什么才能显示漂亮的屏幕?

您可以在 jsfiddle 上显示

我为选择器错误放置了打印屏幕 img

html

<label>
    <select>
        <option selected> Select Box </option>
        <option>Short Option</option>
        <option>This Is A Longer Option</option>
    </select>
</label>

CSS

body, html {background:#444; text-align:center; padding:50px 0;}

/* The CSS */
select {
    padding:3px;
    margin: 0;
    -webkit-border-radius:4px;
    -moz-border-radius:4px;
    border-radius:4px;
    -webkit-box-shadow: 0 3px 0 #ccc, 0 -1px #fff inset;
    -moz-box-shadow: 0 3px 0 #ccc, 0 -1px #fff inset;
    box-shadow: 0 3px 0 #ccc, 0 -1px #fff inset;
    background: #f8f8f8;
    color:#888;
    border:none;
    outline:none;
    display: inline-block;
    -webkit-appearance:none;
    -moz-appearance:none;
    appearance:none;
    cursor:pointer;
}

/* Targetting Webkit browsers only. FF will show the dropdown arrow with so much padding. */
@media screen and (-webkit-min-device-pixel-ratio:0) {
    select {padding-right:18px}
}

label {position:relative}
label:after {
    content:'<>';
    font:11px "Consolas", monospace;
    color:#aaa;
    -webkit-transform:rotate(90deg);
    -moz-transform:rotate(90deg);
    -ms-transform:rotate(90deg);
    transform:rotate(90deg);
    right:8px; top:2px;
    padding:0 0 2px;
    border-bottom:1px solid #ddd;
    position:absolute;
    pointer-events:none;
}
label:before {
    content:'';
    right:6px; top:0px;
    width:20px; height:20px;
    background:#f8f8f8;
    position:absolute;
    pointer-events:none;
    display:block;
}

最佳答案

添加文本溢出

select {
    -moz-appearance: none;
    text-indent: 0.01px;
    text-overflow: '';
}

关于jquery - 使用 css 下拉选择屏幕出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24339336/

相关文章:

javascript - 如何在 jQuery 中显示内容之前显示 setTimeout 图像?

javascript - 对文本字段使用更改事件

jquery - 选择所有具有特定类的后代 HTML 元素,这些元素之间没有具有其他特定类的元素

html - 匹配动态类名的 CSS 通配符选择器?

html - css - 边界相互重叠

html - 横向菜单 : how to float right but keep the menu items in the correct order?

javascript - 使用带有不是从 div 开头开始的标签的省略号

外部链接的 Javascript 不起作用

jquery - ajax post不发送数据

php - 使用jquery上传多张图片