纯css实现一个折叠菜单效果代码

代码语言:html

所属分类:菜单导航

代码描述:纯css实现一个折叠菜单效果代码

代码标签: 一个 折叠 菜单 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">
  

  
<style>
@charset "UTF-8";
details {
  width: 50%;
  margin: 0 auto;
  background: #282828;
  margin-bottom: 0.5rem;
  box-shadow: 0 0.1rem 1rem -0.5rem rgba(0, 0, 0, 0.4);
  border-radius: 5px;
  overflow: hidden;
}

summary {
  padding: 1rem;
  display: block;
  background: #333;
  padding-left: 2.2rem;
  position: relative;
  cursor: pointer;
}

summary:before {
  content: "";
  border-width: 0.4rem;
  border-style: solid;
  border-color: transparent transparent transparent #fff;
  position: absolute;
  top: 1.3rem;
  left: 1rem;
  transform: rotate(0);
  transform-origin: 0.2rem 50%;
  transition: 0.25s transform ease;
}

/* THE MAGIC 🧙‍♀️ */
details[open] > summary:before {
  transform: rotate(90deg);
}

details summary::-webkit-details-marker {
  display: none;
}

details > ul {
  padding-bottom: 1rem;
  margin-bottom: 0;
}

body {
  background: #222;
  height: 100vh;
  font-family: sans-serif;
  color: white;
  line-height: 1.5;
  letter-spacing: 1px;
  margin-top: 2rem;
}
</style>




</head>

<body>
  <detail.........完整代码请登录后点击上方下载按钮下载查看

网友评论0