css实现按钮点击下拉菜单动画效果代码

代码语言:html

所属分类:菜单导航

代码描述:css实现按钮点击下拉菜单动画效果代码

代码标签: css 按钮 点击 下拉 菜单 动画

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

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">


    <style>
        .area::after {
          content: "";
          display: block;
          width: 101%;
        }
        
        body {
          height: 100vh;
          margin: 0;
          display: grid;
          place-items: center;
          background: #2196f3;
          font: 100%/1.4 system-ui, sans-serif;
          line-height: 1.4;
        }
        
        h2 {
          line-height: 1.24;
          margin: 0 0 1rem 0;
        }
        
        .area {
          background: white;
          padding: 60px 25px 25px 25px;
          border-radius: 8px;
          width: 300px;
          box-shadow: 0 0.66rem 2.4rem #0d47a1;
          position: relative;
          overflow: initial;
          word-wrap: break-word;
        }
        img {
          max-width: 100%;
        }
        
        /* super mega terndy mobile menu */
        
        .area .header {
          position: absolute;
          display: block;
          top: 0;
          left: 0;
          height: 50px;
          width: 100%;
          background: rgba(0, 0, 0, 0.8);
          overflow: hidden;
          transition: all 0.5s ease-out, background 1s ease-out;
          transition-delay: 0.2s;
          z-index: 1;
        }
        .area .header .burger-container {
          position: relative;
          display: inline-block;
          height: 50px;
          width: 50px;
          cursor: pointer;
          transform: rotate(0deg);
          transition: all 0.3s cubic-bezier(0.4, 0.01, 0.165, 0.99);
          -webkit-user-select: none;
          -moz-user-select: none;
          -ms-user-select: none;
          user-select: none;
          -webkit-tap-highlight-color: transparent;
        }
        .area .header .burger-container #burger {
          width: 18px;
          height: 8px;
          position: relative;
          display: block;
          margin: -4px auto 0;
          top: 50%;
        }
        .area .header .burger-container #burger .bar {
          width: 100%;
          height: 1px;
          display: block;
          position: relative;
          background: #fff;
          transition: all 0.3s cubic-bezier(0.4, 0.01, 0.165, 0.99);
          transition-delay: 0s;
        }
        .area .header .burger-container #burger .bar.topBar {
          transform: translateY(0px) rotate(0deg);
        }
        .area .header .burger-container #burger .bar.btmBar {
          transform: translateY(6px) rotate(0deg);
        }
        .area .header .icon {
          display: inline-block;
          position: absolute;
          height: 100%;
          line-height: 50px;
          width: 50px;
          height: 50px;
          text-align: center;
          color: #fff;
          font-size: 22px;
          left: 50%;
          transform: translateX(-50%);
        }
        .area .header .icon.icon-bag {
          right: 0;
          top: 0;
          left: auto;
          transform: translateX(0px);
          transition: transform 0.5s cubic-bezier(0.4, 0.01, 0.165, 0.99);
          transition-delay: 0.65s;
        }
        .area .header ul.menu {
          position: relative;
          display: block;
          padding: 0px 48px 0;
          list-style: none;
        }
        .area .header ul.menu li.menu-item {
          border-bottom: 1px solid #333;
          margin-top: 5px;
          transform: scale(1.15) translateY(-30px);
          opacity: 0;
          transition: transform 0.5s cubic-bezier(0.4, 0.01, 0.165, 0.99),
            opacity 0.6s cubic-bezier(0.4, 0.01, 0.165, 0.99);
        }
        .area .header ul.menu li.menu-item:nth-child(1) {
          transition-delay: 0.49s;
        }
        .area .header ul.menu li.menu-item:nth-child(2) {
          transition-delay: 0.42s;
        }
        .area .header ul.menu li.menu-item:nth-child(3) {
          transition-delay: 0.35s;
        }
        .area .header ul.menu li.menu-item:nth-child(4) {
          transition-delay: 0.28s;
        }
        .area .header ul.menu li.menu-item:nth-child(5) {
          transition-delay: 0.21s;
        }
        .area .header ul.menu li.menu-item:nth-child(6) {
          transition-delay: 0.14s;
        }
        .area .header ul.menu li.menu-item:nth-child(7) {
          transition-delay: 0.07s;
        }
        .area .header ul.menu li.menu-item a {
          display: block;
          position: relative;
          color: #fff;
          font-family: "Ek Mukta", sans-serif;
          font-weight: 100;
          text-decoration: none;
          font-size: 22px;
          line-height: 2.35;
          font-weight: 200;
          width: 100%;
        }
        .area .header.menu-opened {
          height: 100%;
          background-color: #000;
          transition: all 0.3s ease-in, background 0.5s ease-in;
          transition-delay: 0.25s;
        }
        .area .header.menu-.........完整代码请登录后点击上方下载按钮下载查看

网友评论0