css手风琴

2017-08-23  本文已影响0人  追风lf
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>11</title>
    <style>
    * {
        padding: 0;
        margin: 0;
    }
    
    body {
        padding: 100px;
    }
    
    li {
        list-style-type: none;
    }
    
    ul {
        width: 600px;
        height: 250px;
        overflow: hidden;
    }
    
    li {
        float: left;
        width: 120px;
        height: 250px;
        -webkit-transition: width 0.5s ease-out;
        -moz-transition: width 0.5s ease-out;
        -ms-transition: width 0.5s ease-out;
        -o-transition: width 0.5s ease-out;
        transition: width 0.5s ease-out;
    }
    
    li:hover {
        width: 400px;
    }
    
    ul:hover li:not(:hover) {
        width: 50px;
    }
    </style>
</head>

<body>
    <ul>
        <li style="background:red">1</li>
        <li style="background:green">2</li>
        <li style="background:yellow">3</li>
        <li style="background:blue">4</li>
        <li style="background:red">5</li>
    </ul>
</body>

</html>

上一篇 下一篇

猜你喜欢

热点阅读