CSS 下拉菜单

创建时间:2019.06.26 修改时间:2019.06.26
<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> 鼠标移动到这里 </span>
  <div class="dropdown-content">
    <p> 弹出信息 </p>
  </div>
</div>

效果如下: