css下拉弹出菜单效果

代码语言:html

所属分类:菜单导航

代码描述:css下拉弹出菜单效果

代码标签: 菜单 效果

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


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
:root {
  --primColor: #dcdcdc;
  --secoColor: #555555;
  --cornerRad: 4px;
}
body {
  background-color: var(--primColor);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 20px;
}
details {
  margin: 40px;
}
summary {
  -webkit-writing-mode: vertical-lr;
      -ms-writing-mode: tb-lr;
          writing-mode: vertical-lr;
  text-align: center;
  padding: 12px 10px;
  width: 23px;
  height: 17px;
  background-color: var(--primColor);
  border: 2px solid var(--secoColor);
  border-radius: var(--cornerRad);
  color: var(--secoColor);
  cursor: pointer;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
  outline: none;
  -webkit-transition: -webkit-transform 200ms ease-in-out 0s;
  transition: -webkit-transform 200ms ease-in-out 0s;
  transition: transform 200ms ease-in-out 0s;
  transition: transform 200ms ease-in-out 0s, -webkit-transform 200ms ease-in-out 0s;
}
summary::before,
summary::after {
  position: static;
  top: 0;
  left: 0;
}
summary::before {
  content: "";
}
summary::after {
  content: "III";
  letter-spacing: -1px;
}
summary:hover {
  -webkit-transform: scale(1.1);
          transform: scale(1.1);
}
summary::marker {
  font-size: 0;
}
summary::-webkit-details-marker {
  display: none;
}
details[open] .menu {
  -webkit-animation-name: menuAnim;
          animation-name: menuAnim;
}
details[open] summary::before {
  content: "X";
}
details[open] summary::after {
  content: "";
}
.menu {
  height: 0;
  width: -webkit-fit-content;
  width: -moz-fit-content;
  width: fit-content;
  border-radius: var(--cornerRad);
  background-color: var(--primColor);
  box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.2);
  margin-top: 8px;
  display: -webkit-box;
  display: flex;
  -webkit-box-orient: v.........完整代码请登录后点击上方下载按钮下载查看

网友评论0