css实现下拉选择菜单

代码:

<style>
 .dropdown {
     position: relative;
     display: inline-block;
 }
.dropdown-content {
     display: none;
     position: absolute;
     background-color: #f9f9f9;
     min-width: 160px;
     box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
     padding: 12px 16px;
     z-index: 1;
}
.dropdown:hover .dropdown-content {
      display: block;
}
</style>

<div class="dropdown">
     <span>Mouse over me</span>
     <div class="dropdown-content">
          <p>Hello World!</p>
     </div>
</div>

在这里插入图片描述

©️2020 CSDN 皮肤主题: 1024 设计师:上身试试 返回首页