6.1

今天学习了css的下拉菜单.

<!DOCTYPE html>

<html>

<head>

 

  <title>下拉菜单实例|W3Cschool教程(w3cschool.cn)</title>

  <meta charset="utf-8">

  <style>

  .dropdown {

      position: relative;

      display: inline-block;

  }

 

  .dropdown-content {

      display: none;

      position: absolute;

      

      min-width: 160px;

      box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);

      padding: 12px 16px;

  }

 

  .dropdown:hover .dropdown-content {

      display: block;

  }

  </style>

</head>

<body>

 

<h2>鼠标移动后出现下拉菜单</h2>

<p>将鼠标移动到指定元素上就能看到下拉菜单。</p>

 

<div class="dropdown">

  <span>鼠标移动到我这!</span>

  <div class="dropdown-content">

    <p>W3Cschool教程</p>

    <p>www.w3cschool.cn</p>

  </div>

</div>

 

</body>

</html>

posted @ 2023-06-11 11:11  一个不会起名字的人  阅读(4)  评论(0编辑  收藏  举报