【发布时间】:2012-12-05 12:10:49
【问题描述】:
我在这里根据解决方案使用自定义选择/下拉菜单:https://stackoverflow.com/a/10190884/1318135
这个功能很好,只是选项只有在您单击该框时才会显示。单击右侧的“箭头”不会显示下拉选项。有什么解决方法?
http://jsfiddle.net/XxkSC/553/
HTML:
<label class="custom-select">
<select>
<option>Sushi</option>
<option>Blue cheese with crackers</option>
<option>Steak</option>
<option>Other</option>
</select>
CSS:
label.custom-select {
position: relative;
display: inline-block;
}
.custom-select select {
display: inline-block;
padding: 4px 3px 3px 5px;
margin: 0;
font: inherit;
outline:none; /* remove focus ring from Webkit */
line-height: 1.2;
background: #000;
color:white;
border:0;
}
/* Select arrow styling */
.custom-select:after {
content: "▼";
position: absolute;
top: 0;
right: 0;
bottom: 0;
font-size: 60%;
line-height: 30px;
padding: 0 7px;
background: #000;
color: white;
}
.no-pointer-events .custom-select:after {
content: none;
}
【问题讨论】:
-
获得了 60% 浏览器支持的解决方案。任何人都可以在 IE 和其他设备上运行任何东西吗?
标签: html css drop-down-menu