<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>布局-居中导航</title>
    <style type="text/css">
    ul{
        text-align: center; /* text-align 只对行级元素起效果*/
        height: 30px;
        line-height: 30px;
        background-color: #f00;
    }

    li,a{
        display: inline-block;
        width: 80px;
        height: 100%;
    }
    li{
        margin: 0 5px; 
        list-style: none;
    }
    a,a:hover,li.cur a{
        color: #fff;
        text-decoration: none;
    }
    a:hover,li.cur a{
        background-color: #c00;
    }
    </style>
</head>
<body>
<ul>
    <li><a href="#">推荐</a></li>
    <li><a href="#">歌单</a></li>
    <li><a href="#">打牌DJ</a></li>
    <li><a href="#">歌手</a></li>
    <li><a href="#">新碟上架</a></li>
</ul>
</body>
</html>

居中导航

相关文章:

  • 2021-12-28
  • 2021-06-25
  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-03
  • 2022-12-23
  • 2021-08-21
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2023-02-11
相关资源
相似解决方案