CSS3——过渡模块——手风琴案例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>CSS3过渡模块-手风琴效果</title>
    <style>
        *{margin: 0;padding: 0;}
        ul{
            width: 960px;
            height: 300px;
            border: 1px solid red;
            margin: auto;
            list-style: none;
            overflow: hidden;
        }
        ul li{
            width: 160px;
            float: left;
            transition: width 1s; 
        }             鼠标悬浮ul时,设置所有li宽度变小
        ul:hover li{  
            width: 100px;
        }       
        ul li:hover{鼠标悬浮当前li时,宽度变宽
            width: 460px;
        }
    </style>
</head>
<body>
<ul>
    <li><img src="video/images/ad1.jpg" alt=""></li>
    <li><img src="video/images/ad2.jpg" alt=""></li>
    <li><img src="video/images/ad3.jpg" alt=""></li>
    <li><img src="video/images/ad4.jpg" alt=""></li>
    <li><img src="video/images/ad5.jpg" alt=""></li>
    <li><img src="video/images/ad6.jpg" alt=""></li>
</ul>
</body>
</html>

鼠标悬浮时效果图:

CSS3——过渡模块——手风琴案例

相关推荐