帝王谷资源网 Design By www.wdxyy.com
下面是一个默认样式的下拉框的长相:
Here is the first option The second option
HTML code:
复制代码代码如下:
<select>
<option>Here is the first option</option>
<option>The second option</option>
</select>
一个选择框的某些部分我们是可以美化的,比如字体、边框、颜色、内边距和背景颜色:
Here is the first option The second option
但是烦人的下拉箭头还是保持不变。没有直接美化它的方式,但解决方案还是非常简单的,首先我们需要用一个div容器包裹在select元素外围:
复制代码代码如下:
<div class="styled-select">
<select>
<option>Here is the first option</option>
<option>The second option</option>
</select>
</div>
下一步我们需要加入一些css,以确保选择框元素被以某种方式美化:
复制代码代码如下:
.styled-select select {
background: transparent;
width: 268px;
padding: 5px;
font-size: 16px;
border: 1px solid #ccc;
height: 34px;
-webkit-appearance: none; /*for chrome*/
}
我们需要确保选择框的跨度比外围的div容器更宽,这样默认的下拉箭头就会消失(译者注:选择框比外面的div宽大,默认的下拉箭头就会被隐藏)
下面是我们要用的新下拉箭头:
我们的div容器需要被美化成新的下拉箭头出现在我们预想的位置:
复制代码代码如下:
.styled-select {
width: 240px;
height: 34px;
overflow: hidden;
background: url(new_arrow.png) no-repeat right #ddd;
}
知道这点解决办法将使你非常容易的,不用别的只使用css就能美化您的选择框。
译者注:在线调式地址http://jsfiddle.net/shishaomeng/KGrYB/ ,各位看官可自行进入调试
Here is the first option The second option
HTML code:
复制代码代码如下:
<select>
<option>Here is the first option</option>
<option>The second option</option>
</select>
一个选择框的某些部分我们是可以美化的,比如字体、边框、颜色、内边距和背景颜色:
Here is the first option The second option
但是烦人的下拉箭头还是保持不变。没有直接美化它的方式,但解决方案还是非常简单的,首先我们需要用一个div容器包裹在select元素外围:
复制代码代码如下:
<div class="styled-select">
<select>
<option>Here is the first option</option>
<option>The second option</option>
</select>
</div>
下一步我们需要加入一些css,以确保选择框元素被以某种方式美化:
复制代码代码如下:
.styled-select select {
background: transparent;
width: 268px;
padding: 5px;
font-size: 16px;
border: 1px solid #ccc;
height: 34px;
-webkit-appearance: none; /*for chrome*/
}
我们需要确保选择框的跨度比外围的div容器更宽,这样默认的下拉箭头就会消失(译者注:选择框比外面的div宽大,默认的下拉箭头就会被隐藏)
下面是我们要用的新下拉箭头:
我们的div容器需要被美化成新的下拉箭头出现在我们预想的位置:
复制代码代码如下:
.styled-select {
width: 240px;
height: 34px;
overflow: hidden;
background: url(new_arrow.png) no-repeat right #ddd;
}
知道这点解决办法将使你非常容易的,不用别的只使用css就能美化您的选择框。
译者注:在线调式地址http://jsfiddle.net/shishaomeng/KGrYB/ ,各位看官可自行进入调试
标签:
CSS美化,选择框
帝王谷资源网 Design By www.wdxyy.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
帝王谷资源网 Design By www.wdxyy.com
暂无评论...
更新日志
2024年10月07日
2024年10月07日
- 群星《前途海量 电影原声专辑》[FLAC/分轨][227.78MB]
- 张信哲.1992-知道新曲与精丫巨石】【WAV+CUE】
- 王翠玲.1995-ANGEL【新艺宝】【WAV+CUE】
- 景冈山.1996-我的眼里只有你【大地唱片】【WAV+CUE】
- 群星《八戒 电影原声带》[320K/MP3][188.97MB]
- 群星《我的阿勒泰 影视原声带》[320K/MP3][139.47MB]
- 纪钧瀚《胎教古典音乐 钢琴与大提琴的沉浸时光》[320K/MP3][148.91MB]
- 刘雅丽.2001-丽花皇后·EMI精选王【EMI百代】【FLAC分轨】
- 齐秦.1994-黄金十年1981-1990CHINA.TOUR.LIVE精丫上华】【WAV+CUE】
- 群星.2008-本色·百代音乐人创作专辑【EMI百代】【WAV+CUE】
- 群星.2001-同步过冬AVCD【环球】【WAV+CUE】
- 群星.2020-同步过冬2020冀待晴空【环球】【WAV+CUE】
- 沈雁.1986-四季(2012梦田复刻版)【白云唱片】【WAV+CUE】
- 纪钧瀚《胎教古典音乐 钢琴与大提琴的沉浸时光》[FLAC/分轨][257.88MB]
- 《国语老歌 怀旧篇 3CD》[WAV/分轨][1.6GB]