纯css制作tab选项卡(二)
2017-10-12 14:25
513 查看
css本身的功能就挺强大的,尤其是css3出来之后,大部分特效只用css3就能完成了,无需再费心思去想js怎么怎么做jQuery怎么怎么做,代码简洁质量轻巧。下面是用纯css制作的tab选项卡效果:
原始界面:
鼠标点击第二个tab选项,相应内容显示:
鼠标划上第三个tab选项:相应内容显示
具体内容自己添加啦,下面献上完整代码:
<DOCTYPE html> <html> <head> <title>Tab选项卡</title> <meta charset="utf-8"> <style type="text/css"> body{ font-size: 0; } .box{ text-align: center; } .box .tab{ display: inline-block; width: 120px 4000 ; height: 44px; padding: 7px; border: 1px solid #ccc; border-bottom: 0px; box-sizing:border-box; background: #fff; font-size: 16px; line-height: 26px; text-decoration: none; color: #555; transition: all 0.5s linear; } .box input[type=radio]{ position: absolute; top: -9999px; left: -9999px; } .box input[type=radio]:checked+.tab{ background-color: #eee; transition: all 0.5s linear; } .box .list{ width: 800px; height: 400px; border: 1px solid #ccc; padding: 10px; position: absolute;/*堆一起*/ left: 50%; margin-left: -400px; z-index: 1; box-sizing:border-box; } .list img{ height: 300px; width: auto; margin: 40px auto; } .box #tab1:checked~#list1, .box #tab2:checked~#list2, .box #tab3:checked~#list3, .box #tab4:checked~#list4{ z-index: 3; } </style> </head> <body> <div class="box"> <input type="radio" id="tab1" name="tab" checked="checked"> <label class="tab" for="tab1">哇咔咔</label> <input type="radio" id="tab2" name="tab"> <label class="tab" for="tab2">太棒了</label> <input type="radio" id="tab3" name="tab"> <label class="tab" for="tab3">纳尼</label> <input type="radio" id="tab4" name="tab"> <label class="tab" for="tab4">不要听</label> <div class="list" id="list1"><img src="img/a.jpg"></div> <div class="list" id="list2"><img src="img/c.jpg"></div> <div class="list" id="list3"><img src="img/f.jpg"></div> <div class="list" id="list4"><img src="img/h.jpg"></div> </div> </body> </html>
相关文章推荐
- 纯CSS制作的TAB选项卡
- 纯css制作tab选项卡(一)
- 用JS制作tab选项卡效果
- jQuery 制作的Tab标签切换选项卡
- js+css实现的圆角边框TAB选项卡滑动门代码分享(2款)
- Axure RP制作tab选项卡
- CSS 实现的简洁选项卡Tab
- css tab选项卡
- CSS+JS打造的非常漂亮的tab选项卡
- css Tab选项卡1
- javascript+css 新闻显示tab 选项卡效果
- HTML CSS +js 实现tab选项卡,自动轮换
- css 手写tab选项卡
- HTML中tab选项卡制作
- 三种简洁的经典高效的DIV+CSS制作的Tab导航简析
- 【转】纯CSS3制作的Tab选项卡
- javascript控制制作tab选项卡(兼容ie6,FF,chrome等)
- JavaScript+Css打造三种简洁的Tab网页选项卡
- 教你怎样制作一款选项卡TAB
- css_jsp制作页面选项卡