css实现紫色大气手机端部导航条效果代码

代码语言:html

所属分类:菜单导航

代码描述:css实现紫色大气手机端部导航条效果代码

代码标签: css 紫色 手机 导航条

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


<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">
  

  
  
  
<style>
:root {
  --black: #121212;
  --accent: #db74ff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html,
body {
  height: 100%;
}

body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

body {
  background-color: #212121;
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

nav {
  position: relative;
  height: 100px;
  width: 400px;
  /* padding: 0px 10px; */
  background-color: var(--black);
  border-radius: 8px;
}

.border-effect {
  position: absolute;
  width: 40px;
  left: 30px;
  height: 10px;
  background-color: var(--accent);
  border-radius: 0px 0px 18px 18px;
  filter: drop-shadow(0px 5px 5px var(--accent));
  transition: all 0.7s;
}

ul {
  display: flex;
  justify-content: space-between;
  height: 100%;
  padding: 0;
}

li {
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-content: space-between;
  align-items: center;
  font-size: 14px;
  font-family: "Nunito Sans", sans-serif;
  list-style: none;
  padding-bottom: 10px;
  color: #40464e;
  font-weight: bold;
  cursor: pointer;
  margin-top: 10px;
  transition: color 1.5s;
}

.active {
  color: var(--accent);
}

svg {
  width: 40px;
  height: 40px;
  margin: 10px 0px;
  fill: var(--black);
  transition: all 1.5s;
}

path {
  stroke: #40464e;
}

.active-fill {
  fill: var(--accent);
}

.active-fill > path {
  stroke: #a14cc0;
  stroke-width: 0.5;
}

#home-no-touch {
  stroke: #fff;
}
</style>


</head>

<body  >
  <nav>
      <ul>
        <div class="border-effect"></div>
        <li id="home" class="active">
          <svg
            class="active-fill"
            id="home-icon"
            width="24"
            height="24"
            viewBox="0 0 24 24"
            xmlns="http://www.w3.org/2000/svg"
          >
            <path
              d="M9.02 2.84004L3.63 7.04004C2.73 7.74004 2 9.23004 2 10.36V17.77C2 20.09 3.89 21.99 6.21 21.99H17.79C20.11 21.99 22 20.09 22 17.78V10.5C22 9.29004 21.19 7.74004 20.2 7.05004L14.02 2.72004C12.62 1.74004 10.37 1.79004 9.02 2.84004Z"
              stroke-width="1.5"
              stroke-linecap="round"
              stroke-linejoin="round"
            />
            <path
              id="home-no-touch"
              d="M12 17.99V14.99"
              stroke="white"
              stroke-width="1.5"
              stroke-linecap="round"
              stroke-linejoin="round"
            />
          </svg>

          <p>Home</p>
        </li>
        <li id="explore">
          <svg
            id="explore-icon"
            width="24"
            height="24"
            viewBox="0 0 24 24"
            xmlns="http://www.w3.org/2000/svg"
          >
            <defs>
              <linearGradient id="my-cool-gradient" x2="1" y2="1">
                <stop offset="5%" stop-color="black" />
                <stop offset="95%" stop-color="black" />
              </linearGradient>
            </defs>
            <path
              d="M17 10H19C21 10 22 9 22 7V5C22 3 21 2 19 2H17C15 2 14 3 14 5V7C14 9 15 10 17 10Z"
              stroke-width="1.5"
              stroke-miterlimit="10"
              stroke-linecap="round"
              stroke-linejoin="round"
            />
            <path
              d="M5 22H7C9 22 10 21 10 19V17C10 15 9 14 7 14H5C3 14 2 15 2 17V19C2 21 3 22 5 22Z"
              stroke-width="1.5"
              stroke-miterlimit="10"
              stroke-linecap="round"
              stroke-linejoin="round"
            />
            <path
              d="M6 10C8.20914 10 10 8.20914 10 6C10 3.79086 8.20914 2 6 2C3.79086 2 2 3.79086 2 6C2 8.20914 3.79086 10 6 10Z"
              stroke-width="1.5"
              stroke-miterlimit="10"
              stroke-linecap="round"
              stroke-linejoin="round"
            />
            <path
              d="M18 22C20.2091 22 22 20.2091 22 18C22 15.7909 20.2091 14 18 14C15.7909 14 14 15.7909 14 18C14 20.2091 15.7909 22 18 22Z"
              stroke-width="1.5"
              stroke-miterlimit="10"
              stroke-linecap="round"
              stroke-linejoin=".........完整代码请登录后点击上方下载按钮下载查看

网友评论0