【发布时间】:2018-11-27 21:36:21
【问题描述】:
我想用这些选择标签创建这个导航,col-md-9,问题是当我向 div 添加背景颜色时,箭头的绿色背景消失了,
我使用这个 html 代码来创建选择,
.select-style {
position: relative;
padding: 0;
margin: 0;
border: 1px solid #ccc;
width: 120px;
height: 30px;
overflow: hidden;
background: transparent url("https://i.imgur.com/qJolQ2D.png") no-repeat 93% 50%;
}
.select-style select {
padding: 5px 8px;
width: 150%;
border: none;
background-color: transparent;
background-image: none;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.select-style select:focus {
outline: none;
}
.select-style:after {
position: absolute;
content: "";
width: 30px;
height: 100%;
background-color: #90c322!important;
top: 0;
right: -1px;
z-index: -1;
border-radius: 0 1px 1px 0;
}
<div class="col-md-9 headerdiv">
<span id="sortby"> Sort By </span>
<div class="select-style" id="style1">
<select>
<option>Position</option>
<option>Position</option>
</select>
</div>
<span id="show"> Show </span>
<div class="select-style" id="style2">
<select>
<option> 5 per page </option>
<option>3 per page </option>
</select>
</div>
<button class="right" value="MORE">1</button>
<button class="right" value="LESS">2</button>
<div id="viewas"> View As</div>
</div>
【问题讨论】:
-
如果您仔细观察,箭头指针就在那里,但它不是绿色的,因为您无法像这样在 css 中更改图像的颜色。
-
假设我想删除这张图片并用箭头替换它,你能帮我吗?
-
或者告诉我如何将它的背景更改为#90c322
-
您可以尝试使用字体很棒的图标,因为它们在技术上是一种您可以编辑它们的字体(更改颜色、大小等)
-
什么浏览器不能用?在 chrome 中看起来不错