简体   繁体   English

如何造型 <select>底部边框和插入符号?

[英]How to style <select> with bottom border and caret?

How can i style the Select element to look like it is in the image? 如何设置Select元素的样式以使其看起来像图像中的? I'm struggling to get both down caret and line to appear at the same time. 我正在努力使插入符号和线条同时出现。 I've tried playing around with setting a border-bottom: 1px and then setting -webkit-appearance: none but the caret disappears. 我试过设置border-bottom: 1px ,然后设置-webkit-appearance: none除尖号消失外-webkit-appearance: none

选择下拉菜单

 select { border: 0px 0px 1px 0px; } 
 <select> <option>Option 1</option> <option>Option 2</option> <option>Option 3</option> </select> 

您将设置border-bottom而不是bottom-border ,它在CSS中不存在

border-bottom
font-family

I think that's all you will really need to change to make it more like the example you've shown 我认为这就是您真正需要做的所有更改,使其更像您显示的示例

I'd start with the "clean sheet" or all: unset to remove all predefined styles of the select element , then style it as desired: 我将从“ clean sheet”all: unset以删除select 元素的所有预定义样式 ,然后根据需要对其进行样式设置

 select { all: unset; padding-right: 15px; border-bottom: 1px solid; background: url('https://www.charbase.com/images/glyph/9662') no-repeat right; background-size: 16px; } 
 <select> <option>All Question Types</option> <option>Option 1</option> <option>Option 2</option> <option>Option 3</option> </select> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM