ionicons+css实现图标导航条效果代码

代码语言:html

所属分类:菜单导航

代码描述:ionicons+css实现图标导航条效果代码

代码标签: ionicons css 图标 导航条

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

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
<style>
    * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

.nav {
  position: relative;
  width: 400px;
  height: 60px;
  background: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 10px;
}
.nav ul {
  display: flex;
  width: 350px;
}
.nav ul li {
  list-style: none;
  position: relative;
  width: 70px;
  height: 60px;
  z-index: 2;
}
.nav ul li a {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  width: 100%;
}
.nav ul li a .icon {
  position: relative;
  display: block;
  width: 55px;
  height: 55px;
  text-align: center;
  line-height: 65px;
  border-radius: 50%;
  color: #222327;
  font-size: 1.5em;
  transition: 0.5s;
  transition-delay: 0s;
}
.nav ul li a .icon::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--clr);
  border-radius: 50%;
  filter: blur(5px);
  opacity: 0;
  transition: 0.5s;
  transition-delay: 0s;
}
.nav ul li.active a .icon {
  background: var(--clr);
  color: #fff;
  transform: translateY(-27px);
  transition-delay: 0.25s;
}
.nav ul li.active a .icon::before {
  opacity: 0.5;
  transition-delay: 0.5s;
}

.indicator {
  position: absolute;
  top: -35px;
  width: 70px;
  height: 70px;
  background: #fff;
  border-radius: 50%;
  z-index: 1;
  transition: 0.5;
}
.indicator::before {
  content: "";
  position: absolute;
  top: 5px;
  left: -28px;
  width: 30px;
  height: 30px;
  background: transparent;
  border-radius: 50%;
  box-shadow: 15px 18px #fff;
}
.indicator::after {
  content: "";
  position: absolute;
  top: 5px;
  right: -28px;
  width: 30px;
  height: 30px;
  background: transparent;
  border-radius: 50%;
  box-shadow: -15px 18px #fff;
}

.nav ul li:nth-child(1).active ~ .indicator {
  transform: translateX(calc(70px * 0));
}
.nav ul li:nth-child(2).active ~ .indicator {
  transform: translateX(calc(70px * 1));
}
.nav ul li:nth-child(3).ac.........完整代码请登录后点击上方下载按钮下载查看

网友评论0