CSS3實現側邊欄快速定位的隱藏和消失

weixin_33830216發表於2018-12-10

Dome

<!DOCTYPE html>
<html>
​
<head>
    <meta charset="utf-8">
    <title>CSS3隱藏懸浮網站左側標籤式導航欄程式碼 </title>
    <style type="text/css">
​
        a:link,
        a:hover,
        a:visited,
        a:active {
            color: #fff;
            text-decoration: none;
        }
​
        body {
            height: 100%;
            width: 100%;
            margin: 0;
            padding: 0;
            background: #fff;
        }
​
        .card-holder {
            position: fixed;
            width: 0px;
            overflow: visible;
            right: 0px;
        }
​
        .card-wrapper {
            display: inline-block;
            float: right;
            clear: both;
        }
​
        .card {
            position: relative;
            left: 100px;
            padding: 7px 32px 7px 64px;
            margin-top: 15px;
            x-box-shadow: 0 0 8px 0px rgba(0, 0, 0, 0.5);
            box-shadow: 8px 0 8px -8px rgba(0, 0, 0, 0.5);
            background: #fff;
            transition: all 0.3s ease-in-out 0.1s;
            border-radius: 5px;
        }
​
        .card:hover {
            position: relative;
            left: 100%;
            margin-left: -100px;
            box-shadow: 0 -8px 8px -8px rgba(0, 0, 0, 0.5),
            0 8px 8px -8px rgba(0, 0, 0, 0.5);
            transition: all 0.3s ease-in-out;
        }
​
        .card-content {
            display: inline-block;
            color: #fff;
            font-family: 'Droid Sans', sans-serif;
            font-size: 16px;
            font-weight: bold;
            white-space: nowrap;
            position: relative;
            left: -15px;
        }
​
        .bg-01 {
            background: #977e78;
        }
​
    </style>
</head>
​
<body>
​
    <div class='card-holder'>
        <div class='card-wrapper'>
            <a href='#'>
                <div class='card bg-01'>
                    <span class='card-content'>更多</span>
                </div>
            </a>
        </div>
    </div>
​
</body>
</html>複製程式碼

效果: 

                                 


相關文章