码迷,mamicode.com
首页 > Web开发 > 详细

css实现下拉框

时间:2014-08-07 12:33:29      阅读:268      评论:0      收藏:0      [点我收藏+]

标签:http   color   os   io   for   2014   ar   div   

CSS:

a, label {
display: block;
border-bottom: 1px solid #ccc;
padding: 1em 2em;
width: 100%;
color: #000;
text-decoration: none;
cursor: pointer;
}

.all-items {
display: none;
}

.show-all {
display: none;
}

.list {
position: relative;
padding-bottom: 3.188em;
}

label {
position: absolute;
bottom: 0;
}

label:before {
content: "More";
}

.show-all:checked ~ .all-items {
display: block;
}

.show-all:checked + label:before {
content: "Less";
}

 

HTML:

<div class="list">
<a href="#">Micket</a>
<a href="#">Mace Windu</a>
<a href="#">Count Dooku</a>
<a href="#">Admiral Ackbar</a>
<a href="#">Padme Amidala</a>

<input id="show-all" class="show-all" type="checkbox" />
<label for="show-all"></label>

<div class="all-items">
<a href="#">Gamorrean Guards</a>
<a href="#">C-3P0</a>
<a href="#">Qui-Gin Jinn</a>
<a href="#">Imperial Guards</a>
<a href="#">Obi-Wan Kenobi</a>
<a href="#">Tie Fighter Pilot</a>
<a href="#">Greedo</a>
</div>
</div>

不兼容IE6、7、8 

转自:http://modernweb.com/2014/07/30/5-things-wont-believe-built-css/

css实现下拉框,布布扣,bubuko.com

css实现下拉框

标签:http   color   os   io   for   2014   ar   div   

原文地址:http://www.cnblogs.com/damade/p/3896474.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!