栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

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

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何从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(更新后)中对其进行了测试。

欢迎所有反馈。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/614870.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号