導航欄實現移入後彈出左右伸縮的過渡(css3)

weixin_42102887發表於2020-11-29
<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="css/tongyong.css">
    <style>
        .nva li{
            float: left;
            margin-left: 20px;
            /* background-color: cornflowerblue; */
        }
        li a{
            color: black;
            /* background-color: blue; */
        }

        li span{
            width: 0;
            height: 3px;
            background-color: brown;
            display: block;
            margin: 3px auto;
            transition: 0.3s width;
        }

        li:hover span{
            width: 90%;
        }
    </style>
</head>

<body>
<div class="nva">
    <ul>
        <li><a href="#">導航欄<span></span></a></li>
        <li><a href="#">返回主頁<span></span></a></li>
        <li><a href="#">登入<span></span></a></li>

    </ul>
</div>
</body>

</html>

相關文章