选择箭头样式更改 [英] select arrow style change

查看:158
本文介绍了选择箭头样式更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将一个选择的箭头替换为我自己的图片。我将选择包含在相同大小的div中,我将选择的背景设置为透明,我在div的右上角包含一个图片(与箭头相同的大小)作为背景。

I'm trying to replace the arrow of a select with a picture of my own. I'm including the select in a div with the same size, I set the background of the select as transparent and I'm including a picture(with the same size as the arrow) in the right top corner of the div as background.

它只能在Chrome中使用。

It only works in Chrome.

如何制作在Firefox和IE9的工作,我得到这个:

How can I make it work in Firefox and IE9 where I'm getting this:

<HTML>
<HEAD>

<style type="text/css">
.styled-select {
   width: 100px;
   height: 17px;
   overflow: hidden;
   overflow: -moz-hidden-unscrollable;
   background: url(images/downarrow_blue.png) no-repeat right white;
   border: 2px double red;
   display: inline-block;
   position:relative;
   }

.styled-select select {
   background: transparent;
   -webkit-appearance: none;
   width: 100px;
   font-size: 11px;
   border: 0;
   height: 17px;
   position: absolute;
   left: 0;
   top: 0;
   }

body {  background-color:#333333;color: #FFFFFF;}
.block label{   color:white;    }

</style>
</HEAD>

<BODY>

<p/>
<form action="/prepareUpdateCategoryList.do?forwardto=search">

<fieldset class="block"  id="searchBlock">
<p>
<label style="width:80px">Class</label>
<div class="styled-select">
    <select property="voucherCategoryClass" >
        <option value="0">Select </option>
        <option value="7382">steam </option>
    </select>
</div>

</p>
</fieldset>
</form>
</BODY>
</HTML>


推荐答案



Have you tried something like this:

.styled-select select {
    appearance:none;
    -moz-appearance:none; /* Firefox */
    -webkit-appearance:none; /* Safari and Chrome */
}

尚未测试,

EDIT :Firefox看起来仍然不支持此功能(在此了解详情

EDIT: It looks like Firefox still doesn't support this feature(read more here)

我找到了一个解决方法此处,请查看 jsfiddle 该帖子。

I have found a workaround here, take a look at jsfiddle on that post.

这篇关于选择箭头样式更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆