我需要在火狐浏览器中去除默认的下拉框箭头
我使用了以下代码:
-webkit-appearance: none;
-moz-appearance:none;
background: rgba(0,0,0,0);
它在Chrome中工作良好,但在Firefox中不起作用。
我需要在火狐浏览器中去除默认的下拉框箭头
我使用了以下代码:
-webkit-appearance: none;
-moz-appearance:none;
background: rgba(0,0,0,0);
它在Chrome中工作良好,但在Firefox中不起作用。
更新:这个问题在Firefox v35中已经修复。有关详细信息,请参见完整的gist。
刚刚发现如何从Firefox中移除选择箭头。诀窍是使用混合-prefix-appearance
、text-indent
和text-overflow
,它是纯CSS,不需要额外的标记。
select {
-moz-appearance: none;
text-indent: 0.01px;
text-overflow: '';
}
在Windows 8、Ubuntu和Mac上测试,使用的是最新版本的Firefox浏览器。
<div class="select-box">
<select>
<option>Mozilla Firefox</option>
<option>Google Chrome</option>
<option>Apple Safari</option>
<option>Internet Explorer</option>
</select>
</div>
2)
.select-box select{width:100%}
/* For Microsoft IE */
select::-ms-expand { display: none; }
/* For Webkit based browsers Google Chrome, Apple Safari and latest Gecko browsers */
select{
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
试一下。希望这能帮到你。适用于最新版本的 Firefox、Chrome、IE 和 Safari,如果不是所有版本的话。但请在所有浏览器的所有版本上进行检查。
我认为在Firefox中没有简单的方法来做到这一点,特别是对于Linux和Mac OS版本。
将选择框的不透明度更改为0,然后使用div/span来包含选择框。之后,在该容器上添加一些样式。这是一个不推荐的解决方法,如果我们只想更改选择框的样式,它的成本太高了。但是,它无论如何都解决了问题。希望这可以帮助到你。=)
原文:
<select>
<option>Value 1</option>
<option>Value 2</option>
</select>
新的:
<span class="select-container">
<select>
<option>Value 1</option>
<option>Value 2</option>
</select>
</span>
风格:
.select-container {
width: 100px;
height: 30px;
position: relative;
border: 1px solid #ccc;
background: url("path of the arrow image") no-repeat right center;
background-size: 25px;
}
select {
position: absolute;
opacity: 0;
outline: 0;
}
如何在Chrome和Mozilla中简单地去除下拉箭头
与选择相关的。select {
/*for firefox*/
-moz-appearance: none;
/*for chrome*/
-webkit-appearance:none;
}
/*for IE10*/
select::-ms-expand {
display: none;
}
<select>
<option>India</option >
<option>India</option >
<option>India</option >
</select>
$(document).ready(function(){
$(".selsect_class").each(function(){
$(this).after("<span class='select_holder'></span>");
});
$(".selsect_class").change(function(){
var selectedOption = $(this).find(":selected").text();
$(this).next(".select_holder").text(selectedOption);
}).trigger('change');
})
.selsect_id{
background: url("http://a1lrsrealtyservices.com/demo/ot-select.png") no-repeat scroll right center #fff;
border: 1px solid #ccc;
border-radius: 2px;
box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.05) inset;
box-sizing: border-box;
display: block;
font-size: 12px;
height: 29px;
margin: 0 5px 5px 0;
width: 100%;
}
.selsect_class{
cursor: pointer;
font-size: 14px;
height: 29px;
opacity: 0;
position: relative;
width: inherit;
z-index: 4;
}
.selsect_class option{padding: 3px 15px;}
.select_holder{position: absolute;left: 30px;top: 5px;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="selsect_id">
<select class="selsect_class">
<option value="">- Choose One -</option>
<option value="1">jillur</option>
<option value="2">korim</option>
<option value="3">rohim</option>
<option value="4">Uncategorized</option>
</select>
</div>
gcyrillus 在此网站上提出了一个简洁的解决方案。
http://css-tricks.com/forums/topic/remove-select-arrow-for-chrome-and-firefox/