利用css3实现侧边栏

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        @import url(http://www.jq22.com/jquery/font-awesome.4.6.0.css);

        @import url(https://fonts.googleapis.com/css?family=Montserrat|Open+Sans:400,300);

        *{
            margin: 0;
            padding: 0;
            list-style: none;
            box-sizing: border-box;
        }
        a{
            text-decoration: none;
            color: #fff;
            font-weight: bold;
            display: block;
        }
        body{
            text-align: center;
            background: #EFEFEF;
            color: #fff;
        }
        .container{
            width:285px;
            height: 500px;
            margin: 0 auto;
            background: #000;
            overflow: hidden;
            position: relative;
        }
        .cover{
            width: 100%;
            height: 100%;
            background: url("../jquery-css3-150315214850/img/mb1.png") no-repeat 100% 100%;
            transition:all 0.25s;
            position: relative;
            z-index: 99;
        }
        label{
            padding: 10px;
            border: 2px solid #fff;
            position: relative;
            top:200px;
            cursor: pointer;
        }
        ul{
            position: absolute;
            left: 0;
            top:0;
            bottom: 0;
            width: 150px;
            background: #2f3238;
            padding-top: 50px;
        }
        li{
            line-height: 48px;
        }
        .container i{
            display: block;
            width: 50px;
            float: left;
            font-size: 16px;
            line-height: 48px;
            text-align: center;
        }
        .container b{
            display: block;
            opacity: 0;
            transform: translateX(150px);
            transition: all 0.4s;
        }
        input:checked+.container .cover{
            transform: translateX(150px);
        }
        input:checked+.container b{
            transform: translateX(0);
            opacity: 1;
        }
        input:checked+.container li:nth-child(1) b{
            transition-delay:0.08s;
        }
        input:checked+.container li:nth-child(2) b{
            transition-delay:0.16s;
        }
        input:checked+.container li:nth-child(3) b{
            transition-delay:0.24s;
        }
        input:checked+.container li:nth-child(4) b{
            transition-delay:0.32s;
        }
        input:checked+.container li:nth-child(5) b{
            transition-delay:0.40s;
        }
        input:checked+.container li:nth-child(6) b{
            transition-delay:0.48s;
        }
    </style>
</head>
<body>
<input type="checkbox" style="display: none" id="selected">
<div class="container">
    <div class="cover"><label for="selected">Click Me</label></div>
    <ul>
        <li><a href="javascript:;"><i class="fa fa-check"></i><b>Tasks</b></a></li>

        <li><a href="javascript:;"><i class="fa fa-inbox"></i><b>Messages</b></a></li>

        <li><a href="javascript:;"><i class="fa fa-pencil"></i><b>New Post</b></a></li>

        <li><a href="javascript:;"><i class="fa fa-cog"></i><b>Settings</b></a></li>

        <li><a href="javascript:;"><i class="fa fa-star"></i><b>Starred</b></a></li>

        <li><a href="javascript:;"><i class="fa fa-power-off"></i><b>Logout</b></a></li>
    </ul>
</div>
<script>

</script>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值