首页 > Web开发 > 详细

css实现下拉框

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

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://www.cnblogs.com/damade/p/3896474.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!