CSS 基础学习-188 给导航添加边框

hrs 提交于 2022/03/02 - 06:42 , 周三

给导航添加边框

实例代码;

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <style>
      ul{
        list-style-type:none;
        margin:0;
        padding:0;
      }
      a.active{
      background-color:green;
      }
      li a {
          background-color:#cccccc;
          width:100px;
          display:block;
          padding:8px 16px;
          text-decoration:none;
          border:1px solid black;
      }
      li a:hover{
      background-color:#555;
      color:white;
      }
    </style>
  </head>
  <body>

    <h1>给导航添加边框</h1>
    <p>在此例中,我们创建一个具有边框的导航链接</p>
    <ul>
      <li><a class="active "href="https://www.dwoke.com">首页</a></li>
      <li><a href="https://www.dwoke.com">文章</a></li>
      <li><a href="https://www.dwoke.com">下载</a></li>
      <li><a href="https://www.dwoke.com">文档</a></li>
      <li><a href="https://www.dwoke.com">关于</a></li>
    </ul>
  </body>
</html>

运行效果:

css-188.png

标签