标签 html 下的文章

先看效果:
PixPin_2024-06-18_08-12-55.gif
HTML代码如下:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>科幻卡片悬停效果</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <div class="container">
      <div class="box" style="--clr: #f00">
        <ion-icon name="brush-outline"></ion-icon>
        <h2>01<br /><small>Design</small></h2>
        <div class="clip">
          <span></span>
          <span></span>
          <span></span>
        </div>
      </div>

      <div class="box" style="--clr: #0f0">
        <ion-icon name="code-slash-outline"></ion-icon>
        <h2>02<br /><small>Code</small></h2>
        <div class="clip">
          <span></span>
          <span></span>
          <span></span>
        </div>
      </div>

      <div class="box" style="--clr: #f0f">
        <ion-icon name="rocket-outline"></ion-icon>
        <h2>03<br /><small>Launch</small></h2>
        <div class="clip">
          <span></span>
          <span></span>
          <span></span>
        </div>
      </div>
    </div>


  </body>
</html>

CSS代码如下:



* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

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

.container {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 150px;
  flex-wrap: wrap;
}

.container .box {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 240px;
  height: 320px;
  background-color: var(--clr);
  box-shadow: 0 0 0 15px #0009,
    0 25px 55px var(--clr);

}

.container .box h2 {
  position: relative;
  color: #020d1e;
  font-size: 4em;
  text-align: center;
  line-height: 2.5em;
  transform: scale(0);
  transition: .5s;
  transition-delay: 0;
  filter: blur(10px);
}

.container .box h2 small {
  font-size: .35em;
  text-transform: uppercase;
  font-weight: 500;
}

.container .box:hover h2 {
  transform: scale(1);
  filter: blur(0);
}

.container .box ion-icon {
  position: absolute;
  font-size: 4em;
  transition: .5s;
  transition-delay: 0;
  transform: translateY(100px);
  opacity: 0;
}

.container .box:hover ion-icon {
  transition-delay: 1s;
  opacity: 1;
  transform: translateY(0);
}

.container .box .clip {
  position: absolute;
  inset: 20px;
  box-shadow: 0 0 0 18px #020d1e;
}

.container .box .clip span {
  position: absolute;
  inset: 0;
  background-color: #202d1e;
  transition: .25s;
}

.container .box .clip span:nth-child(1) {
  clip-path: polygon(0 0, 50% 40%, 100% 0);
  transition-delay: 0;
}

.container .box:hover .clip span:nth-child(1) {
  clip-path: polygon(0 0, 50% 0, 100% 0);
}

.container .box .clip span:nth-child(2) {
  clip-path: polygon(0 0, 40% 50%, 50% 100%, 0% 100%);
  transition-delay: .25s;
}

.container .box:hover .clip span:nth-child(2) {
  clip-path: polygon(0 0, 0 100%, 50% 100%, 0% 100%);
}


.container .box .clip span:nth-child(3) {
  clip-path: polygon(60% 50%, 100% 0, 100% 100%, 50% 100%);
  transition-delay: .5s;
}

.container .box:hover .clip span:nth-child(3) {
  clip-path: polygon(100% 100%, 100% 0, 100% 100%, 50% 100%);
}

看效果:
PixPin_2024-06-12_11-08-23.gif
THML代码:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>动态数据滚动效果</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <section>
      <h2>Scroll To Reveal</h2>
    </section>
    <div class="container"></div>
    <script>
      for (let i = 0; i <= 60; i++) {
        const box = document.createElement("div");
        box.classList.add("box");
        document.querySelector(".container").appendChild(box);
      }

      const randomColorBlock = document.querySelectorAll(".box");

      function addColor() {
        randomColorBlock.forEach((e) => {
          e.style.background = randomColor();
        });
      }

      function randomColor() {
        const chars = "1234567890abcdef",
          colorLength = 6;
        let color = "";
        for (let i = 1; i <= colorLength; i++) {
          const rondomColors = Math.floor(Math.random() * chars.length);
          color += chars.substring(rondomColors, rondomColors + 1);
        }
        return "#" + color;
      }

      addColor();

      const boxes = document.querySelectorAll(".box");

      function scrollTrigger() {
        boxes.forEach((boxxx) => {
          if (boxxx.offsetTop < window.scrollY) {
            boxxx.classList.add("active");
          } else {
            boxxx.classList.remove("active");
          }
        });
      }

      window.addEventListener("scroll", scrollTrigger);
    </script>
  </body>
</html>

CSS代码:

@import url("https://fonts.googleapis.com/css?family=Poppins:200,300,400,500,600,700,800,900&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  background-color: #111;
  overflow-x: hidden;
}

section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

section h2 {
  position: relative;
  color: #fff;
  font-size: 8vw;
  font-weight: 500;
}

.container {
  position: relative;
  top: -200px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  width: 700px;
  grid-gap: 30px;
}

.container .box {
  position: relative;
  top: 50vh;
  width: 200px;
  height: 200px;
  transition: 0.5s;
  background-color: #fff;
  border-radius: 10px;
}

.container .box:nth-child(3n + 1) {
  transform: translate(-400px, 0) scale(0);
}

.container .box:nth-child(3n + 2) {
  transform: translate(0, 400px) scale(0);
}

.container .box:nth-child(3n + 3) {
  transform: translate(400px, 0) scale(0);
}

.container .box.active {
  transform: translate(0, 0) scale(1);
}

先看看效果:
PixPin_2024-06-10_17-57-17.gif
HTML代码:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>CSS带有滑动菜单指示器的导航选项卡</title>
    <link rel="stylesheet" href="style.css" />
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css"
    />
  </head>
  <body>
    <div class="tabs">
      <input type="radio" id="home" name="tabsMenu" checked />
      <input type="radio" id="profile" name="tabsMenu" />
      <input type="radio" id="likes" name="tabsMenu" />
      <input type="radio" id="settings" name="tabsMenu" />
      <input type="radio" id="notifications" name="tabsMenu" />
      <div class="buttons">
        <label for="home"><i class="fa-solid fa-house"></i></label>
        <label for="profile"><i class="fa-solid fa-user"></i></label>
        <label for="likes"><i class="fa-solid fa-heart"></i></label>
        <label for="settings"><i class="fa-sharp fa-solid fa-gear"></i></label>
        <label for="notifications"><i class="fa-solid fa-bell"></i></label>
        <div class="underline"></div>
      </div>
    </div>
  </body>
</html>

CSS代码:

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

.tabs input {
  visibility: hidden;
  display: none;
}

.buttons {
  position: relative;
  display: flex;
  gap: 80px;
  padding: 30px 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  background-color: #182d3c;
  overflow: hidden;
  border-radius: 20px;
}

.buttons label {
  width: 20%;
  font-size: 1.75em;
  -webkit-text-stroke: 1px #fff;
  color: transparent;
  opacity: 0.3;
  cursor: pointer;
  transition: 0.5s;
}

.buttons label:hover {
  opacity: 1;
  filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 20px #fff);
}

.tabs input:nth-child(1):checked ~ .buttons label:nth-child(1),
.tabs input:nth-child(2):checked ~ .buttons label:nth-child(2),
.tabs input:nth-child(3):checked ~ .buttons label:nth-child(3),
.tabs input:nth-child(4):checked ~ .buttons label:nth-child(4),
.tabs input:nth-child(5):checked ~ .buttons label:nth-child(5) {
  color: #fff;
  opacity: 1;
  filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 20px #fff);
}

.underline {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 20%;
  height: 5px;
  transition: 0.5s;
}

.underline::before {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  border-radius: 4px;
  height: 100%;
  background-color: #fff;
  filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 20px #fff)
    drop-shadow(0 0 30px #fff) drop-shadow(0 0 50px #fff);
}

.underline::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  border-radius: 4px;
  height: 100%;
  background-color: #fff;
  filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 20px #fff)
    drop-shadow(0 0 30px #fff) drop-shadow(0 0 50px #fff) blur(5px);
}

.tabs input:nth-child(1):checked ~ .buttons .underline {
  left: 0;
}

.tabs input:nth-child(2):checked ~ .buttons .underline {
  left: 20%;
}

.tabs input:nth-child(3):checked ~ .buttons .underline {
  left: 40%;
}

.tabs input:nth-child(4):checked ~ .buttons .underline {
  left: 60%;
}
.tabs input:nth-child(5):checked ~ .buttons .underline {
  left: 80%;
}

看一下效果:
PixPin_2024-06-09_08-43-35.gif

HTML代码:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>手机充电动画</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <div class="container">
      <div class="number">66.6%</div>
      <div class="contrast">
        <div class="circle"></div>
        <ul id="bubbles" class="bubbles"></ul>
      </div>
    </div>
    <script>
      const bubbles = document.getElementById("bubbles");
      for (let i = 0; i < 15; i++) {
        const bubble = document.createElement("li");
        const width = `${15 + 15 * Math.random()}px`;
        const left = `${15 + 70 * Math.random()}px`;
        const duration = `${3 + 6 * Math.random()}s`;
        const delay = `${(5000 * Math.random()) / 1000}s`;
        bubble.style.width = width;
        bubble.style.height = width;
        bubble.style.left = left;
        bubble.style.animation = `moveToTop ${duration} ease-in-out ${delay} infinite`;
        bubbles.appendChild(bubble);
      }
    </script>
  </body>
</html>

CSS代码:

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: #000;
  overflow: hidden;
}

.container {
  position: relative;
  width: 300px;
  height: 400px;
}

.number {
  position: absolute;
  width: 300px;
  top: 24%;
  text-align: center;
  font-size: 32px;
  color: #fff;
  z-index: 10;
}

.contrast {
  width: 300px;
  height: 400px;
  background-color: #000;
  overflow: hidden;
  filter: contrast(10) hue-rotate(0);
  animation: hueRotate 10s infinite linear;
}

.circle {
  position: relative;
  width: 300px;
  height: 300px;
  filter: blur(8px);
}

.circle::after {
  content: "";
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(0);
  width: 200px;
  height: 200px;
  background-color: #00ff6f;
  border-radius: 42% 38% 62% 49% / 45%;
  animation: rotate 10s infinite linear;
}

.circle::before {
  content: "";
  position: absolute;

  width: 176px;
  height: 176px;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background-color: #000;
  z-index: 10;
}

.bubbles {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 100px;
  height: 40px;
  transform: translate(-50%, 0);
  border-radius: 100px 100px 0 0;
  background-color: #00ff6f;
  filter: blur(5px);
}

li {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background-color: #00ff6f;
}

@keyframes rotate {
  50% {
    border-radius: 45% / 42% 38% 58% 49%;
  }
  100% {
    transform: translate(-50%, -50%) rotate(720deg);
  }
}

@keyframes hueRotate {
  100% {
    filter: contrast(15) hue-rotate(360deg);
  }
}

@keyframes moveToTop {
  90% {
    opacity: 1;
  }
  100% {
    opacity: 0.1;
    transform: translate(-50%, -180px);
  }
}

看一下效果:
PixPin_2024-05-29_15-48-43.gif
HTML代码:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>CSS漩涡背景效果</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <div class="bg">
      <span style="--i: 0"></span>
      <span style="--i: 1"></span>
      <span style="--i: 2"></span>
      <span style="--i: 3"></span>
      <span style="--i: 4"></span>
      <span style="--i: 5"></span>
      <span style="--i: 6"></span>
      <span style="--i: 7"></span>
      <span style="--i: 8"></span>
      <span style="--i: 9"></span>
      <span style="--i: 10"></span>
      <span style="--i: 11"></span>
    </div>
  </body>
</html>

css代码:

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  background-color: #fff;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.bg {
  position: absolute;
  width: 200vw;
  height: 200vh;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: animate 10s linear infinite;
}

@keyframes animate {
  0% {
    transform: rotate(0);
  }
  100% 
  {
    transform: rotate(360deg);
  }
}

.bg span {
  position: absolute;
  width: 500px;
  height: 150vh;
  transform: translate(-50%, -50%) rotate(calc(30deg * var(--i)));
  transform-origin: bottom right;
}

.bg span::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-bottom-left-radius: 500px;
  box-shadow: -90px -90px 0 89.20px #ff0954;
}

.bg span:nth-child(even)::before {
  box-shadow: -90px -90px 0 89.20px #3c4396;
}

看效果:
PixPin_2024-05-23_08-29-39.gif
HTML代码:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>CSS发光立体</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <div class="box">
      <div class="top"></div>
      <div>
        <span style="--n: 0"></span>
        <span style="--n: 1"></span>
        <span style="--n: 2"></span>
        <span style="--n: 3"></span>
      </div>
    </div>
  </body>
</html>

CSS代码:

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

.box div {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.box div span {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(#222, #2bf82b);
  opacity: 0.8;
  transform: rotateY(calc(90deg * var(--n))) translateZ(150px);
  border: 5px solid green;
}

.box {
  position: relative;
  width: 300px;
  height: 300px;
  transform-style: preserve-3d;
  transform: rotateX(-30deg);
  animation: rotate 5s linear infinite;
}

@keyframes rotate {
  0% {
    transform: rotateX(-30deg) rotateY(0deg);
  }
  100% {
    transform: rotateX(-30deg) rotateY(360deg);
  }
}

.top {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #333;
  box-shadow: 0 0 10px 5px green, 0 0 200px 7px greenyellow,
    0 0 200px 20px lightgreen, 0 0 30px 25px green;
  transform: rotateX(90deg) translateZ(150px);
}

.top::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  box-shadow: 0 0 120px rgba(0, 255, 0, 0.2), 0 0 200px rgba(0, 255, 0, 0.4),
    0 0 200px rgba(0, 255, 0, 0.4), 0 0 200px rgba(0, 255, 0, 0.4);
  filter: blur(20px);
  transform: translateZ(-350px);
}

先看效果:
PixPin_2024-05-18_08-55-29.gif
HTML代码

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>CSS数据雨云效果</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <div class="container">
      <div class="cloud">
        <h2>Data Clouds Rain</h2>
      </div>
    </div>

    <script>
      const randomText = () => {
        const text = "!@#$%^&*()_+",
          letters = text[Math.floor(Math.random() * text.length)];
        return letters;
      };

      const rain = () => {
        const cloud = document.querySelector(".cloud"),
          e = document.createElement("div");
        e.classList.add("drop");
        cloud.appendChild(e);
        const left = Math.floor(Math.random() * 290),
          size = Math.random() * 1.5,
          duration = Math.random() * 1;

        e.innerText = randomText();
        e.style.left = left + "px";
        e.style.fontSize = 0.5 + size + "em";
        e.style.animationDuration = 1 + duration + "s";

        setTimeout(() => {
          cloud.removeChild(e);
        }, 2000);
      };

      setInterval(() => {
        rain();
      }, 20);
    </script>
  </body>
</html>

CSS代码

@import url("https://fonts.googleapis.com/css?family=Poppins:200,300,400,500,600,700,800,900&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

:root {
  --clr: #0f0;
}

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

.container {
  position: relative;
  top: 100px;
  width: 100%;
  height: 400px;
  display: flex;
  justify-content: center;

  animation: animateColor 5s linear infinite;
  border: 35px solid transparent;
}

@keyframes animateColor {
  0% {
    filter: hue-rotate(0);
  }

  100% {
    filter: hue-rotate(360deg);
  }
}

.container .cloud {
  position: relative;
  width: 300px;
  z-index: 100;
  filter: drop-shadow(0 0 35px var(--clr));
}

.container .cloud h2 {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  color: #000;
  font-size: 2em;
  z-index: 1000;
  font-weight: 400;
  padding: 0 10px;
  border-radius: 10px;
  text-transform: uppercase;
  background-color: var(--clr);
}

.container .cloud h2::before {
  content: "";
  position: absolute;
  top: -115px;
  left: 50%;
  width: 120%;
  height: 100px;
  border-radius: 100px;
  transform: translateX(-50%);
  background-color: var(--clr);
}

.container .cloud h2::after {
  content: "";
  position: absolute;
  top: -150px;
  left: 25px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background-color: var(--clr);
  box-shadow: 120px -30px 0 40px var(--clr);
}

.container .cloud .drop {
  position: absolute;
  top: 60px;
  height: 20px;
  line-height: 20px;
  color: var(--clr);
  transform-origin: bottom;
  animation: animate 2s linear infinite;
}

@keyframes animate {
  0% {
    transform: translateY(0) scaleY(0);
    transform-origin: top;
  }

  10% {
    transform: translateY(0) scaleY(0.25);
    transform-origin: top;
  }

  20% {
    transform: translateY(0) scaleY(1);
  }

  70% {
    transform: translateY(300px) scaleY(1);
    transform-origin: bottom;
  }

  80% {
    transform: translateY(300px) scaleY(1);
    transform-origin: bottom;
  }

  100% {
    transform: translateY(300px) scaleY(0);
    transform-origin: bottom;
    text-shadow: -180px 0 0 var(--clr), 180px 0 0 var(--clr);
  }
}

看看效果
PixPin_2024-05-16_09-46-40.gif

HTML代码:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>滚动页面菜单指示器导航</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <header>
      <nav>
        <a href="#home" style="--clr: #f3218b" class="active">
          <span class="icon"><ion-icon name="home-outline"></ion-icon></span>
          <span class="text">Home</span>
        </a>
        <a href="#profile" style="--clr: #2196f3">
          <span class="icon"><ion-icon name="person-outline"></ion-icon></span>
          <span class="text">Profile</span>
        </a>
        <a href="#message" style="--clr: #008a1b">
          <span class="icon"
            ><ion-icon name="chatbubble-outline"></ion-icon
          ></span>
          <span class="text">Message</span>
        </a>
        <a href="#photos" style="--clr: #dc1dff">
          <span class="icon"><ion-icon name="camera-outline"></ion-icon></span>
          <span class="text">Photos</span>
        </a>
        <a href="#settings" style="--clr: #d56f1d">
          <span class="icon"
            ><ion-icon name="settings-outline"></ion-icon
          ></span>
          <span class="text">Settings</span>
        </a>
        <div class="indicator"></div>
      </nav>
    </header>
    <section id="home">Home</section>
    <section id="profile">Profile</section>
    <section id="message">Message</section>
    <section id="photos">Photos</section>
    <section id="settings">Settings</section>

    <script
      type="module"
      src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"
    ></script>
    <script
      nomodule
      src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"
    ></script>
    <script>
      const sec = document.querySelectorAll("section"),
        links = document.querySelectorAll("header nav a");

      window.onscroll = () => {
        sec.forEach((section) => {
          const top = window.scrollY,
            offset = section.offsetTop,
            height = section.offsetHeight,
            id = section.getAttribute("id");
          if (top >= offset && top < offset + height) {
            links.forEach((link) => {
              link.classList.remove("active");
              document
                .querySelector("header nav a[href*=" + id + "]")
                .classList.add("active");
            });
          }
        });
      };
    </script>
  </body>
</html>

CSS代码

/*google-fonts*/
/* @import url('https://fonts.googleapis.com/css?family=Poppins:200,300,400,500,600,700,800,900&display=swap'); */
@import './google-fonts.css';

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', sans-serif;
}

section {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 6em;
  font-weight: 800;
  color: rgba(255, 255, 255, .1);
  background-color: #333; 
  text-transform: uppercase;
}

section:nth-child(even) {
  background-color: #444;
}

header {
  position: fixed;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100000;
  width: 400px;
  height: 60px;
  background-color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 10px;
  filter: drop-shadow(0 15px 35px rgba(0, 0, 0, .5));
}

header nav {
  display: flex;
  width: 350px;
}

header nav a {
  position: relative;
  list-style: none;
  width: 70px;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  width: 100%;
  text-align: center;
  font-weight: 500;
  z-index: 2;
}

header nav a .icon {
  position: relative;
  display: block;
  line-height: 65px;
  font-size: 1.5em;
  text-align: center;
  transition: .5s;
  color: #666;
}

header nav a.active .icon {
  transform: translateY(-32px);
  color: var(--clr);
}

header nav a .text {
  position: absolute;
  color: #fff;
  padding: 2px 7px;
  border-radius: 12px;
  font-weight: 400;
  font-size: .75em;
  letter-spacing: .05em;
  transition: .5s;
  transform: translateY(15px);
  opacity: 0;
}

header nav a.active .text {
  transform: translateY(-4px);
  background-color: var(--clr);
  opacity: 1;
}

.indicator {
  position: absolute;
  top: -35px;
  width: 70px;
  height: 70px;
  background-color: #fff;
  border-radius: 50%;
  transition: .5s;
  z-index: 1;
}

.indicator::before {
  content: '';
  position: absolute;
  top: 5px;
  left: -28px;
  width: 30px;
  height: 30px;
  background-color: transparent;
  border-radius: 50%;
  box-shadow: 15px 18px #fff;
}

.indicator::after {
  content: '';
  position: absolute;
  top: 5px;
  right: -28px;
  width: 30px;
  height: 30px;
  background-color: transparent;
  border-radius: 50%;
  box-shadow: -15px 18px #fff;
}

header nav a:nth-child(1).active ~ .indicator {
  transform: translateX(calc(70px * 0));
}

header nav a:nth-child(2).active ~ .indicator {
  transform: translateX(calc(70px * 1));
}

header nav a:nth-child(3).active ~ .indicator {
  transform: translateX(calc(70px * 2));
}

header nav a:nth-child(4).active ~ .indicator {
  transform: translateX(calc(70px * 3));
}

header nav a:nth-child(5).active ~ .indicator {
  transform: translateX(calc(70px * 4));
}

效果如下:
PixPin_2024-05-15_07-37-21.gif

HTML代码

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>使用 CSS Clip-path 的纯 CSS3 水波文本动画效果</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <div class="content">
      <h2>Water</h2>
      <h2>Water</h2>
    </div>
  </body>
</html>

CSS代码

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

.content {
  position: relative;
}

.content h2 {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 8em;
}

.content h2:nth-child(1) {
  color: transparent;
  -webkit-text-stroke: 2px #03a9f4;
}

.content h2:nth-child(2) {
  color: #03a9f4;
  animation: animate 4s ease-in-out infinite;
}

@keyframes animate {
  0%,
  100% {
    clip-path: polygon(
      0% 45%,
      15% 44%,
      32% 50%,
      54% 60%,
      70% 61%,
      84% 59%,
      100% 52%,
      100% 100%,
      0% 100%
    );
  }

  50% {
    clip-path: polygon(
      0% 60%,
      16% 65%,
      34% 66%,
      51% 62%,
      67% 50%,
      84% 45%,
      100% 46%,
      100% 100%,
      0% 100%
    );
  }
}

看一下展示效果
PixPin_2024-05-08_11-11-56.gif
HTML代码:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>曲线导航菜单指示器</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <div class="navigation">
      <ul>
        <li class="list active">
          <a href="#">
            <span class="icon">
              <ion-icon name="home-outline"></ion-icon>
            </span>
            <span class="text">Home</span>
          </a>
        </li>
        <li class="list">
          <a href="#">
            <span class="icon">
              <ion-icon name="person-outline"></ion-icon>
            </span>
            <span class="text">Profile</span>
          </a>
        </li>
        <li class="list">
          <a href="#">
            <span class="icon">
              <ion-icon name="chatbubble-outline"></ion-icon>
            </span>
            <span class="text">Message</span>
          </a>
        </li>
        <li class="list">
          <a href="#">
            <span class="icon">
              <ion-icon name="camera-outline"></ion-icon>
            </span>
            <span class="text">Photo</span>
          </a>
        </li>
        <li class="list">
          <a href="#">
            <span class="icon">
              <ion-icon name="settings-outline"></ion-icon>
            </span>
            <span class="text">Settings</span>
          </a>
        </li>
        <div class="indicator"></div>
      </ul>
    </div>
    <script
      type="module"
      src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"
    ></script>
    <script
      nomodule
      src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"
    ></script>
    <script>
      const list = document.querySelectorAll(".list");
      function activeLink() {
        list.forEach((item) => item.classList.remove("active"));
        this.classList.add("active");
      }
      list.forEach((item) => item.addEventListener("click", activeLink));
    </script>
  </body>
</html>

CSS代码:

@import url("https://fonts.googleapis.com/css?family=Poppins:100,200,300,400,500,600,700,800,900");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

:root {
  --clr: #222327;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: var(--clr);
}

.navigation {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 400px;
  height: 70px;
  background-color: #fff;
  border-radius: 10px;
}

.navigation ul {
  display: flex;
  width: 350px;
}

.navigation ul li {
  position: relative;
  list-style: none;
  width: 70px;
  height: 70px;
  z-index: 1;
}

.navigation ul li a {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  width: 100%;
  text-align: center;
  font-weight: 500;
}

.navigation ul li .icon {
  position: relative;
  display: block;
  line-height: 75px;
  font-size: 1.5em;
  text-align: center;
  transition: 0.5s;
  color: var(--clr);
}

.navigation ul li.active .icon {
  transform: translateY(-32px);
}

.navigation ul li .text {
  position: absolute;
  color: var(--clr);
  font-weight: 400;
  font-size: 0.75em;
  letter-spacing: 0.05em;
  transition: 0.5s;
  opacity: 0;
  transform: translateY(20px);
}

.navigation ul li.active .text {
  opacity: 1;
  transform: translateY(10px);
}

.indicator {
  position: absolute;
  top: -50%;
  width: 70px;
  height: 70px;
  background: #29fd53;
  border-radius: 50%;
  border: 6px solid var(--clr);
  transition: 0.5s;
}

.indicator::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -22px;
  width: 20px;
  height: 20px;
  background: transparent;
  border-top-right-radius: 20px;
  box-shadow: 1px -10px 0 0 var(--clr);
}

.indicator::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -22px;
  width: 20px;
  height: 20px;
  background: transparent;
  border-top-left-radius: 20px;
  box-shadow: -1px -10px 0 0 var(--clr);
}

.navigation ul li:nth-child(1).active ~ .indicator {
  transform: translateX(calc(70px * 0));
}

.navigation ul li:nth-child(2).active ~ .indicator {
  transform: translateX(calc(70px * 1));
}

.navigation ul li:nth-child(3).active ~ .indicator {
  transform: translateX(calc(70px * 2));
}

.navigation ul li:nth-child(4).active ~ .indicator {
  transform: translateX(calc(70px * 3));
}

.navigation ul li:nth-child(5).active ~ .indicator {
  transform: translateX(calc(70px * 4));
}