div+css实现立体方块图标菜单悬浮凸起动画效果代码

代码语言:html

所属分类:菜单导航

代码描述:div+css实现立体方块图标菜单悬浮凸起动画效果代码

代码标签: div css 立体 方块 图标 菜单 悬浮 凸起 动画

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

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/all.6.4.0.css">
<style>
    @import url("https://fonts.googleapis.com/css2?family=Oswald:wght@400;700&display=swap");
* {
  font-family: "Oswald", sans-serif;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #e3e3e3;
}

ul {
  position: relative;
  transform: skewY(-25deg);
}
ul li {
  position: absolute;
  top: 0;
  transform: translate(calc(var(--i) * 40px), calc(var(--i) * 40px));
  list-style: none;
  width: 100px;
  padding: 15px;
  background: #383838;
  transition: 0.5s;
}
ul li a {
  text-decoration: none;
  color: transparent;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: 0.5s;
}
ul li a span {
  position: absolute;
  top: 0;
  left: -40px;
  width: 40px;
  text-align: center;
  height: 100%;
  color: var(--clr);
  transform-origin: right;
  transform: skewY(45deg);
  transition: 0.5s;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.25em;
}
ul li::before {
  content: "";
  position: absolute;
  top: 0;
  left: -40px;
  width: 40px;
  height: 100%;
  background: #2f2f30;
  transform-origin: right;
  transform: skewY(45deg);
  transition: 0.5s;
}
ul li::after {
  content: attr(data-text);
  position: absolute;
  top: -39px;
  left: 0;
  width: 100%;
  height: 40px;
  background: #3e3e3e;
  transform-origin: bottom;
  transform: skewX(45deg);
  box-shadow: -120px -120px 20px rgba(0, 0, 0, 0.25);
  transition: 0.5s;
  display: flex;
  align-items: center;
  text-transform: uppercase;
  left: 0.05em;
  padding-left: 15px;
  box-sizing: border-box;
  color: var(--clr);
}
ul li:hover {
  top: -54px;
  background: var(--clr);
}
ul li:ho.........完整代码请登录后点击上方下载按钮下载查看

网友评论0