纯CSS实现table切换;lable+radio组合,仅供参考思路

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>纯css-label+radio组成tab切换</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<style>
.main{
    position: relative;
    width: 1200px;
    height: 800px;
/*    border: 1px solid red;*/
    margin: 0 auto;
}
.photo{
    position: absolute;
    right: 0px;
    left: -480px;
}
label{
    cursor: pointer;
    display: inline-block;
    opacity: 0.5;
    height: 100px;
    width: 230px;
    margin-top: 100px;
    background-color: transparent;
    border-radius: 4px;
    text-align: center;
    border: 1px solid black;
    line-height: 100px;
}
label:hover{
opacity: 1;
}
input{
display:none;
}
ul{
    list-style: none;
    padding: 0px;
    height: 320px;
    overflow: hidden;
    margin-left: 480px;
    position: relative;
}
.set_page1:checked + ~.photo ul li:nth-child(1){
    position: absolute;
    top: 0px;
    z-index: 25;
    width: 1180px;
}
.set_page2:checked ~.photo ul li:nth-child(2){
    position: absolute;
    top: 0;
    z-index: 22;
    width: 1180px;
}
.set_page3:checked ~.photo ul li:nth-child(3){
    position: absolute;
    top: 0;
    z-index: 23;
    width: 1180px;
}
.set_page4:checked ~.photo ul li:nth-child(4){
    position: absolute;
    top: 0;
    z-index: 24;
    width: 1180px;
}


.set_page5:checked ~.photo ul li:nth-child(5){
    position: absolute;
    top: 0;
    width: 1180px;
}
.texts{
    width:1180px;
    height: 318px;
    border: 1px solid black;
    border-radius: 4px;
    overflow: hidden;
    overflow-y: inherit;
}
</style>
</head>
<body>
    <div class="main">
            <input type="radio" name="p" id="name1" class="set_page1"/>
            <input type="radio" name="p" id="name2" class="set_page2"/>
            <input type="radio" name="p" id="name3" class="set_page3"/>
            <input type="radio" name="p" id="name4" class="set_page4"/>
            <input type="radio" name="p" id="name5" class="set_page5"/>
            
            <!--lable中的for需要绑定对应的input的id-->
            <label for="name1" class="c1">第一页</label>
            <label for="name2" class="c2">第二页</label>
            <label for="name3" class="c3">第三页</label>
            <label for="name4" class="c4">第四页</label>
            <label for="name5" class="c5">第五页</label>    
            <div class="photo">
                <ul>
                    <li class="li1">
                        <!-- <img src="http://pic.qiantucdn.com/images/banner/5a254c9364060.jpg"/> -->
                        <div class="texts">内容</div>
                    </li>
                    <li>
                        <!-- <img src="http://pic.qiantucdn.com/images/banner/5a21328de4e82.jpg"/> -->
                        <div class="texts">内容1</div>
                    </li>
                    <li>
                        <!-- <img src="http://pic.qiantucdn.com/images/banner/5a1545ec5960a.jpg"/> -->
                        <div class="texts">内容2</div>
                    </li>
                    <li>
                        <!-- <img src="http://pic.qiantucdn.com/images/banner/5a1bc5717486e.jpg"/> -->
                        <div class="texts">内容3</div>
                    </li>
                    <li>
                       <!--  <img src="http://pic.qiantucdn.com/images/banner/59f7d0b097669.jpg"/> -->
                       <div class="texts">内容4</div>
                    </li>
                </ul>
            </div>
        </div>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值