怎么做这用代码个导航栏

img

简简单单,代码如下:

<!DOCTYPE html>
<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>测试</title>
    <style>
        div a{
            display: inline-block;
            width: 50px;
            height: 25px;
            line-height: 25px;
            text-align: center;
            margin-left: 3px;
            background-color:crimson;
            text-decoration: none;
            color: white;
            font-weight: bold;
        }
        div a:hover{
            background-color: orange;
        }
    </style>
</head>
<body>
    <div>
        <a href="">新闻</a>
        <a href="">体育</a>
        <a href="">汽车</a>
        <a href="">好用</a>
    </div>
</body>
</html>

运行结果:

img

html的比较容易,就定位和div