html - 如何使用箭头和分隔线设置选择下拉菜单的样式?

标签 html css

到目前为止,这是我设置选择框样式的方式:

enter image description here

需要的改变:

1) 箭头应该在中间 2)箭头图像层必须大于选择框,这样它的颜色是黑色的,背景不会像现在这样透明。 3) 一定要在箭头左边加上分隔线。

这是上面选择框的 CSS:

.styled select {
   font-size: 16px;
   outline:none;
   z-index:100 !important;
} 

.styled{
   height: 40px;
   border-radius: 3px;
   background: url("../img/down.png") 96%/ 15% no-repeat;
   z-index:1000 !important;
}

和 html:

<div class="styled">
                  <select name="sorty" id="sorty">
                    <option class='sort' selected disabled>Sort by</option>
                    <option value="review">Review Count</option>
                    <option value="score">Review Score</option>
                    <option value="price_down">Price ($)</option>
                    <option value="price_up">Price ($$$)</option>
                    <option value="distance">Distance (Nearest)</option>
                  </select>
                 </div>

最佳答案

尝试使用下面的css,它可能对你有帮助

    .styled select {height: 40px;border: 0;color: #acacac; background: url(http://maps.vermont.gov/Geocortex/Essentials/ANR/REST/sites/StreamAlterations/viewers/StreamAlterations/VirtualDirectory/Resources/Images/Icons/arrow-down-small-16.png) #FFF right 10px no-repeat;
-webkit-appearance: none;-moz-appearance: none;appearance: none;padding-right: 52px;padding-left: 13px;}

关于html - 如何使用箭头和分隔线设置选择下拉菜单的样式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34371476/

相关文章:

html - 页脚 float 到页面中间

html - 不同屏幕尺寸 Bootstrap 导航栏中心对齐

jquery - 如何让 li 项目落在鼠标指针处

html - 无法解释的 CSS float 和位置堆叠 :relative

html - 如何在 CSS 中获得文本背后的坚实背景?

javascript - 如何创建 Pixi.js 烟雾面具?

javascript - 检查 'Input Field' 是否包含特定字母 E 或 B ...返回所需页面

php - 为什么我收到的邮件没有任何内容?

html - Owl Carousel : first slide not trigger action

css - 如何使用css3制作动画弧线