百叶窗
lix_uan 74 2

效果图

1

HTML

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>百叶窗</title>
    <link rel="stylesheet" href="index.css">
</head>
<body>
    <ul class="main">
        <li>
            <img src="images/1.jpg" alt="">
            <div class="flag">春</div>
        </li>
        <li>
            <img src="images/2.jpg" alt="">
            <div class="flag">夏</div>
        </li>
        <li>
            <img src="images/3.jpg" alt="">
            <div class="flag">秋</div>
        </li>
        <li>
            <img src="images/4.jpg" alt="">
            <div class="flag">冬</div>
        </li>
    </ul>
</body>
</html>

CSS

*{
    margin: 0;
    padding: 0;
}

ul, ol{
    list-style: none;
}

body{
    background: url("images/bg.jpg");
    background-size: 645px;
}

.main{
    width: 645px;
    height: 320px;
    margin: 150px auto;
    overflow: hidden;
}

li{
    width:160px;
    float: left;
    border-left: 1px solid #fff;
    position: relative;
    transition: all 1s;
}

.flag{
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 60px;
    line-height: 60px;
    text-align: center;
    color: #fff;
    background: rgba(0,0,0,0.5);
}

.main:hover li{
    width:40px;
}

.main li:hover{
    width: 520px;
}
预览图
评论区

索引目录