css实现高斯模糊效果的tab导航条选项卡效果代码

代码语言:html

所属分类:菜单导航

代码描述:css实现高斯模糊效果的tab导航条选项卡效果代码

代码标签: css 高斯模糊 tab 导航条 选项卡

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

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
<style>
    .tabs {
  --background: #fff;
  --width: 300px;
  --height: 75px;
  --border-radius: var(--height);
  background: var(--background);
  width: var(--width);
  height: var(--height);
  position: relative;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 30px rgba(229, 232, 239, 0.2);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 15px;
  box-sizing: border-box;
}
.tabs label {
  -webkit-tap-highlight-color: transparent;
  width: 28px;
  height: 28px;
  cursor: pointer;
  position: relative;
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.tabs label .icon {
  width: 100%;
  height: 100%;
  position: relative;
}
.tabs label .icon .detail,
.tabs label .icon .glass,
.tabs label .icon .background {
  position: absolute;
  width: 100%;
  height: 100%;
}
.tabs label .icon .detail {
  z-index: 2;
  filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, 0));
  transition: filter 0.3s ease;
}
.tabs label .icon .detail::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, #c5ccdc 30%, #96a2be 70%);
  transition: background 0.3s ease;
}
.tabs label .icon .glass {
  z-index: 1;
}
.tabs label .icon .glass::before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background: #e5e8ef;
  -webkit-backdrop-filter: blur(0px);
          backdrop-filter: blur(0px);
}
.tabs label .icon .glass::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  filter: blur(4px);
  opacity: 0;
  z-index: 1;
}
.tabs label .icon .background {
  z-index: 0;
  opacity: 0;
  transform-origin: 100% 100%;
  transform: translate(var(--x, 0), var(--y, 0)) rotate(var(--z, 0));
  transition: transform 0.3s cubic-bezier(0.38, -0.12, 0.15, 1.65);
}
.tabs label:nth-of-type(1) .icon .glass,
.tabs label:nth-of-type(1) .icon .glass::after,
.tabs label:nth-of-type(1) .icon .background {
  -webkit-clip-path: url(#path-icon-01);
          clip-path: url(#path-icon-01);
}
.tabs label:nth-of-type(2) .icon .glass,
.tabs label:nth-of-type(2) .icon .glass::after,
.tabs label:nth-of-type(2) .icon .background {
  -webkit-clip-path: url(#path-icon-02);
          clip-path: url(#path-icon-02);
}
.tabs label:nth-of-type(3) .icon .glass,
.tabs label:nth-of-type(3) .icon .glass::after,
.tabs label:nth-of-type(3) .icon .background {
  -webkit-clip-path: url(#path-icon-03);
          clip-path: url(#path-icon-03);
}
.tabs label:nth-of-type(4) .icon .glass,
.tabs label:nth-of-type(4) .icon .glass::after,
.tabs label:nth-of-type(4) .icon .background {
  -webkit-clip-path: url(#path-icon-04);
          clip-path: url(#path-icon-04);
}
.tabs label:nth-of-type(1) .icon .detail::after {
  -webkit-clip-path: url(#path-detail-01);
          clip-path: url(#path-detail-01);
}
.tabs label:nth-of-type(2) .icon .detail::after {
  -webkit-clip-path: url(#path-detail-02);
          clip-path: url(#path-detail-02);
}
.tabs label:nth-of-type(3) .icon .detail::after {
  -webkit-clip-path: url(#path-detail-03);
          clip-path: url(#path-detail-03);
}
.tabs label:nth-of-type(4) .icon .detail::after {
  -webkit-clip-path: url(#path-detail-04);
          clip-path: url(#path-detail-04);
}
.tabs input {
  display: none;
}
.tabs input:checked + label .icon .detail {
  filter: drop-shadow(2px 2px 2px rgba(85, 85, 85, 0.3));
}
.tabs input:checked + label .icon .detail::after {
  background: linear-gradient(to right, rgba(255, 255, 255, 0.2) 30%, white 70%);
}
.tabs input:checked + label .icon .glass::before {
  background: rgba(255, 255, 255, 0.3);
  -webkit-backdrop-filter: blur(2px);
          backdrop-filter: blur(2px);
}
.tabs input:checked + label .icon .glass::after {
  opacity: 1;
  filter: blur(4px);
}
.tabs input:checked + label .icon .background {
  --x: 4px;
  --y: -4px;
  --z: 15deg;
  opacity: 1;
}
.tabs input:checked + label:nth-of-type(4n-3) .icon .glass::after {
  background: rgba(52, 138, 254, 0.5);
}
.tabs input:checked + label:nth-of-type(4n-3) .icon .background {
  background: radial-gradient(circle, #348afe 0%, #71adfe 100%);
}
.tabs input:checked + label:nth-of-type(4n-2) .icon .glass::after {
  background: rgba(174, 123, 251, 0.5);
}
.tabs input:checked + label:nth-of-type(4n-2) .icon .background {
  background: radial-gradient(circle, #ae7bfb 0%, #d2b6fd 100%);
}
.tabs input:checked + label:nth-of-type(4n-1) .icon .glass::after {
  background: rgba(249, 89, 159, 0.5);
}
.tabs input:checked + label:nth-of-type(4n-1) .icon .background {
  background: radial-gradient(circle, #f9599f 0%, #fb94c1 100%);
}
.tabs input:checked + label:nth-of-ty.........完整代码请登录后点击上方下载按钮下载查看

网友评论0