css_7 padding 左右内边距撑开

2018-11-19  本文已影响0人  basicGeek
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css">
        body,ul,li{
            margin:0;
            padding: 0;
        }
        ul,li{
            list-style: none;
        }
        .nav{
            width: 800px;
            height: 40px;
            background: pink;
            margin: 20px auto;
        }
        .nav ul li{
            float: left;

        }
        .nav ul li a{
            display: inline-block;
            height: 40px;
            font: 14px/40px 微软雅黑;
            padding:0 20px;
            text-decoration: none;
        }
        .nav ul li a:hover{
            background: #aaa;
        }

    </style>
</head>
<body>
    <div class="nav">
        <ul>
            <li><a href="#">百度</a></li>
            <li><a href="#">百度一下</a></li>
            <li><a href="#">14期威武</a></li>
        </ul>
    </div>
</body>
</html>
左右内边距撑开
上一篇 下一篇

猜你喜欢

热点阅读