css导航制作

79 阅读1分钟
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 如果元素的子集浮动,则无法撑大其父级,需要单独设置 */
        li{
            list-style: none;
            width: 100px;
            height: 40px;
            border:1px solid #7f7f7f;
            text-align:center;
            line-height: 40px;
            color:red;
            float: left;
        }
        a{
            /* 行元素转化为块元素 */
            display:block;
            width: 100px;
            height: 40px;
            text-decoration: none;
            color:red;

        }
    </style>
</head>
<body>
    <ul>
        <li><a href="">京东</a></li>
        <li><a href="">阿里</a></li>
        <li><a href="">腾讯</a></li>
        <li><a href="">百度</a></li>
    </ul>
</body>
</html>