简体   繁体   English

如何在HTML和CSS中更改下拉框背景以及箭头?

[英]How to change dropdown box background along with arrow in HTML & CSS?

I need to change the background of the drop down box 我需要更改下拉框的背景

<select>
   <option value="Chrome">Google Chrome</option>
   <option value="Fire Fox">Fire Fox</option>
   <option value="Opera">Opera</option>
  </select>

1)Below is the CSS 2)i can give background but it will be display like below link http://jsfiddle.net/vamsivelaga/9bt5vncg/ 1)下面是CSS 2)我可以给背景,但是它会显示如下链接http://jsfiddle.net/vamsivelaga/9bt5vncg/

select{
    float: left;
    width: 100px;
    height: 26px;
    border: 1px solid #d4d4d4;
    margin: 10px 0 0 10px;
    text-overflow: '';
    background: url(http://s24.postimg.org/lyhytocf5/dropdown.png) no-repeat right 0;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    -o-appearance: none;
    -ms-appearance: none;}

If you want to change the color of the background, just add some color at the end of "background". 如果要更改背景颜色,只需在“背景”末尾添加一些颜色即可。

For example .drop_down_style{ background: url( http://s24.postimg.org/lyhytocf5/dropdown.png ) no-repeat right #000; 例如,.drop_down_style {背景:url( http://s24.postimg.org/lyhytocf5/dropdown.png )禁止重复权限#000; } }

The above code adds black color and replaces the default image with the url which is provided. 上面的代码添加了黑色,并用提供的网址替换了默认图片。

You can refer to this link if needed. 如果需要,您可以参考此链接

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

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