flex模式下的导航条示例

<!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="./less/less002.css"> -->
    <style>
        * {
  margin: 0px;
  padding: 0px;
  list-style: none;
}
nav {
  background-color: #E8E7E3;
  line-height: 40px;
  height: 40px ;
  width: 800px;
  margin: 10px auto;
  display: flex;
}
nav li {
  flex-grow: 1;
}
nav a {
  display: block;
  text-decoration: none;
  color: #808080;
  text-align: center;
}
nav a:hover {
  background-color: dimgray;
  color: white;
}
    </style>
</head>
<body>
    <nav>
        <li><a href="#">HTML/CSS</a></li>
        <li><a href="#">Browser 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> -->
    </nav>
</body>
</html>
posted @ 2020-02-20 16:01  玄空2  阅读(289)  评论(0编辑  收藏  举报