【发布时间】:2018-11-27 19:23:08
【问题描述】:
我有一段使用select 标签的html 代码。我需要用新的 segoe 图标覆盖默认的下拉图标。我使用以下代码做到了这一点:
.select {
border: 1px solid #ccc;
overflow: hidden;
height: 40px;
width: 240px;
position: relative;
display: block;
}
select {
height: 40px;
padding: 5px;
border: 0;
font-size: 16px;
width: 240px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.select:after {
content: "\e0e5";
font-family: segoe mdl2 assets;
color: #000;
padding: 12px 8px;
position: absolute;
right: 0;
top: 0;
background: red;
z-index: 1;
text-align: center;
width: 10%;
height: 100%;
box-sizing: border-box;
}
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" />
<label class="select">
<select name="email" id="email">
<option>aaaa1</option>
<option>aaaa2</option>
<option>aaaa3</option>
<option>aaaa4</option>
<option>aaaa5</option>
<option>aaaa6</option>
</select>
</label>
我的问题是,当点击新的下拉图标时,下拉列表没有填充。因为它就像选择选项标签上的图标。我尝试使用z-index,但它会将图标完全移到后面。有人可以提供解决方案吗?
【问题讨论】:
-
或许尝试将其设置为背景图片