1. <!DOCTYPE html>
    2. <html lang="zh-CN">
    3. <head>
    4. <meta charset="UTF-8" />
    5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    7. <link rel="stylesheet" href="index.css" />
    8. <title>Index</title>
    9. </head>
    10. <body>
    11. <div class="dropdown">
    12. <button>名称</button>
    13. <ul>
    14. <li></li>
    15. <li></li>
    16. <li></li>
    17. </ul>
    18. </div>
    19. </body>
    20. </html>
    button {
      padding: 0;
      margin: 0;
      width: 100px;
      font-size: 16px;
      border: none;
      background-color: yellowgreen;
    }
    ul {
      padding: 0;
      margin: 0;
    }
    ul li {
      list-style: none;
    }
    
    .dropdown {
      width: 100px;
      margin: 0 auto;
      text-align: center;
      cursor: pointer;
    }
    .dropdown ul {
      display: none;
    }
    .dropdown:hover ul {
      display: block;
    }