利用纯css做选项卡源码

<!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8"> <style type="text/css"> .shang {
float: left;
}


.content {
position: absolute;
left: 0px;
top: 60px;
z-index: -100;
display: none;
border: 1px gray solid;
border-radius: 0px 8px 8px 8px;
width: 400px;
height: 300px;
background-color: #DCDCDC;
}


.wai {
position: relative;
margin: 0 auto;
width: 600px;
}


input[name="zu"]:checked~div {
display: block;
}


label {
width: 80px;
height: 40px;
text-align: center;
line-height: 40px;
background-color: #a9a9a9;
display: inline-block;
border: 1px gray solid;
margin-top: 20px;
border-radius: 8px 8px 0px 0px;
border-bottom-width: 0px;
position: relative;
}


input[name="zu"] {
float: left;
position: absolute;
top: -9999px;
left: -9999px;
}


input[name="zu"]:checked+label {
height: 50px;
line-height: 50px;
margin-top: 10px;
background-color: #dcdcdc;
}


</style> </head> <body> <div class="wai"> <div class="shang"> <input type="radio" name="zu" checked id="s1"> <label for="s1">选项卡1</label> <div class="content">选项卡1的内容</div> </div> <div class="shang"> <input type="radio" name="zu" checked id="s2"> <label for="s2">选项卡2</label> <div class="content">选项卡2的内容</div> </div> </body> </html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值