CSS 弹性盒导航条练习

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./reset.css">
    <style>
        .nav{
     
     
           width: 1220px;
           height: 48px;
           margin:50px auto;
           background-color: #e8e7e3; 
           line-height: 48px;
           display: flex;
           flex-direction:row;
        }
        .nav li{
     
     
            /* 设置增长系数 */
            flex-grow: 1;
        }
        .nav a{
     
     
            display: block;
            color:#808080;
            font-size: 16px;
            text-align: center;
        }
        a:hover{
     
     
            background-color:#636363;
            color:white;
        }
    </style>
</head>
<body>
    <ul class="nav">
        <li>
            <a href="#">HTML/CSS</a>
        </li>
        <li>
            <a href="#">Brower Side</a>
        </li>
        <li>
            <a href="#">Server Side/a>
        </li>
        <li>
            <a href="#">Programming</a>
        </li>
        <li>
            <a href="#">XML</a>
        </li>
        <li>
            <a href="#">Web Building</a>
        </li>
        <li>
            <a href="#">Reference</a>
        </li>
    </ul>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/weixin_47401101/article/details/113350819