如何从Firefox中的选择元素中删除箭头

如何从Firefox中的选择元素中删除箭头,第1张

如何从Firefox中的选择元素中删除箭头

好的,我知道这个问题很旧,但是两年之后,mozilla却什么也没做。

我想出了一个简单的解决方法。

这实际上会剥离firefox中选择框的所有格式,并使用自定义样式在选择框周围包裹一个span元素,但应仅适用于firefox。

说这是您的选择菜单:

<select >  <option value='1'> First option </option>  <option value='2'> Second option </option></select>

并假设css类“ css-select”为:

.css-select {   background-image: url('images/select_arrow.gif');   background-repeat: no-repeat;   background-position: right center;   padding-right: 20px;}

在firefox中,它将与选择菜单一起显示,然后是难看的firefox选择箭头,然后是外观漂亮的自定义箭头。不理想。

现在,要在Firefox中进行此 *** 作,请在类’css-select-moz’周围添加一个span元素:

   <span >     <select >       <option value='1'> First option </option>       <option value='2'> Second option </option>     </select>   </span>

然后修复CSS,使用-moz-appearance:window隐藏mozilla的脏箭头,并将自定义箭头扔到span的类’css-select-
moz’中,但只能使其显示在mozilla上,如下所示:

.css-select {   -moz-appearance:window;   background-image: url('images/select_arrow.gif');   background-repeat: no-repeat;   background-position: right center;   padding-right: 20px;}@-moz-document url-prefix() {.css-select-moz{     background-image: url('images/select_arrow.gif');     background-repeat: no-repeat;     background-position: right center;     padding-right: 20px;  }}

挺酷的,因为仅在3小时前遇到了这个错误(我是网页设计的新手,完全是自学成才的)。但是,这个社区间接地为我提供了很多帮助,我认为现在该是我回馈社会的时候了。

我只在firefox(mac)版本18和22(更新后)中对其进行了测试。

欢迎所有反馈。



欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/zaji/5620969.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-15
下一篇 2022-12-15

发表评论

登录后才能评论

评论列表(0条)

保存