svg+css实现左侧垂直图标菜单伸缩堆叠操作效果代码
代码语言:html
所属分类:菜单导航
代码描述:svg+css实现左侧垂直图标菜单伸缩堆叠操作效果代码
代码标签: svg css 左侧 垂直 图标 菜单 伸缩 堆叠 操作
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
background: #f7f7f7;
}
svg {
display: inline-block;
width: 32px;
}
.main {
background: white;
position: absolute;
left: 68px;
top: 8px;
right: 8px;
bottom: 8px;
border-radius: 8px;
filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.15));
}
.stack {
position: relative;
display: flex;
flex-direction: column-reverse;
justify-content: center;
align-items: center;
width: 32px;
transition: all 0.2s;
filter: drop-shadow(0px 1px 1px rgba(0, 0, 0, 0.2));
position: absolute;
bottom: 8px;
left: 8px;
background: #ededed;
padding: 8px 10px 4px 10px;
border-radius: 12px;
cursor: pointer;
}
svg {
height: 32px;
width: 32px;
border-radius: 4px;
background-size: cover;
overflow: hidden;
position: relative;
margin-bottom: 4px;
transition: all 0.15s;
transform-origin: 50% 50%;
}
svg:nth-child(2) {
z-index: 3;
}
svg:nth-child(3) {
z-index: 2;
}
svg:nth-child(4) {
z-index: 1;
}
.icon-add {
width: 12px;
height: 12px;
}
.icon-chevron {
width: 6px;
height: 7px;
}
.stack.closed {
padding-top: 0;
}
.stack.closed svg {
transform: scale(0%) translate(0px);
height: 0;
opacity: 0;
}
.stack.closed svg:nth-child(n+4) {
margin-bottom: 1px;
}
.stack.closed svg:nth-child(1) {
opacity: 1;
width: 6px;
height: 7px;
transform: scale(100%) translate(0px) rotate(-180deg);
}
.stack.closed svg:nth-child(2) {
transform: scale(100%) translate(0px);
opacity: 1;
width: 32px;
height: 32px;
}
.stack.closed svg:nth-child(3) {
transform: scale(83.3333%) translateY(0px);
opacity: 0.8;
width: 32px;
height: 32px;
margin-bottom: -26px;
}
.stack.closed svg:nth-child(4) {
transform: scale(66.6667%) translateY(0px);
opacity: 0.6;
width: 32px;
height: 32px;
margin-bottom: -26px;
}
.stack.closed:hover {
padding-top: 0;
}
.stack.closed:hover svg:nth-child(3) {
transform: scale(83.3333%) translateY(-2px);
opacity: 1;
}
.stack.closed:hover svg:nth-child(4) {
transform: scale(.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0