2024年5月

看一下效果:
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));
}

先看效果:
PixPin_2024-05-07_08-02-39.gif

Html代码

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Glassmorphism Cards Hover Effects</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <div class="container">
      <div class="box" data-color="clr1">
        <div class="imgBx">
          <img src="./images/img_01.jpg" />
        </div>
        <div class="glass">
          <h3>Someone<br /><span>SEO Expert</span></h3>
          <ul>
            <a href="#" style="--i: 1"
              ><ion-icon name="logo-linkedin"></ion-icon
            ></a>
            <a href="#" style="--i: 2"
              ><ion-icon name="logo-whatsapp"></ion-icon
            ></a>
            <a href="#" style="--i: 3"
              ><ion-icon name="logo-instagram"></ion-icon
            ></a>
          </ul>
        </div>
      </div>

      <div class="box" data-color="clr2">
        <div class="imgBx">
          <img src="./images/img_02.jpg" />
        </div>
        <div class="glass">
          <h3>Someone<br /><span>Magician</span></h3>
          <ul>
            <a href="#" style="--i: 1"
              ><ion-icon name="logo-linkedin"></ion-icon
            ></a>
            <a href="#" style="--i: 2"
              ><ion-icon name="logo-whatsapp"></ion-icon
            ></a>
            <a href="#" style="--i: 3"
              ><ion-icon name="logo-instagram"></ion-icon
            ></a>
          </ul>
        </div>
      </div>

      <div class="box" data-color="clr3">
        <div class="imgBx">
          <img src="./images/img_03.jpg" />
        </div>
        <div class="glass">
          <h3>Someone<br /><span>Graphic Designer</span></h3>
          <ul>
            <a href="#" style="--i: 1"
              ><ion-icon name="logo-linkedin"></ion-icon
            ></a>
            <a href="#" style="--i: 2"
              ><ion-icon name="logo-whatsapp"></ion-icon
            ></a>
            <a href="#" style="--i: 3"
              ><ion-icon name="logo-instagram"></ion-icon
            ></a>
          </ul>
        </div>
      </div>

      <div class="box" data-color="clr4">
        <div class="imgBx">
          <img src="./images/img_04.jpg" />
        </div>
        <div class="glass">
          <h3>Someone<br /><span>Actress</span></h3>
          <ul>
            <a href="#" style="--i: 1"
              ><ion-icon name="logo-linkedin"></ion-icon
            ></a>
            <a href="#" style="--i: 2"
              ><ion-icon name="logo-whatsapp"></ion-icon
            ></a>
            <a href="#" style="--i: 3"
              ><ion-icon name="logo-instagram"></ion-icon
            ></a>
          </ul>
        </div>
      </div>
    </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>
  </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;
  min-height: 100vh;
  background-color: #111;
  transition: 0.5s;
}

body:has(.box[data-color="clr1"]:hover) {
  background-color: #162527;
}

body:has(.box[data-color="clr2"]:hover) {
  background-color: #202011;
}

body:has(.box[data-color="clr3"]:hover) {
  background-color: #5b4510;
}

body:has(.box[data-color="clr4"]:hover) {
  background-color: #611417;
}

.container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
  flex-wrap: wrap;
}

.container .box {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: 0.5s;
}

.container .box .imgBx {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  border: 4px solid rgba(0, 0, 0, 0.2);
}

.container .box .imgBx img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: 0.5s;
  border-radius: 10px;
}

.container .box:hover .imgBx img {
  opacity: 0.5;
}

.container .box .glass {
  position: absolute;
  inset: 0;
  background: linear-gradient(#fff2, transparent);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 15px 15px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(15px);
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  scale: 0;
  opacity: 0;
  transition: 0.5s;
}

.container .box .glass::before {
  content: "";
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 40px;
  background-color: rgba(255, 255, 255, 0.05);
}

.container .box:hover {
  transform: rotate(-15deg);
}

.container .box:hover .glass {
  transform: rotate(20deg);
  scale: 1;
  opacity: 1;
}

.container .box .glass h3 {
  font-size: 1.25em;
  color: #fff;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  line-height: 0.8em;
}

.container .box .glass h3 span {
  font-weight: 400;
  font-size: 0.5em;
}

.container .box ul {
  position: absolute;
  bottom: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 15px;
}

.container .box ul a {
  color: #fff8;
  font-size: 1.25em;
  scale: 0;
  transition: 0.25s;
  transition-delay: scale calc(0.2s * var(--i));
}

.container .box:hover ul a {
  scale: 1;
}

.container .box ul a:hover {
  color: #fff;
}

"

漂亮、创意登录注册框。

HTML代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login - Register Form - CodeCraftedWeb</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="container">
        <div class="main">
            <input type="checkbox" id="chk" aria-hidden="true">
            <div class="login">
                <form class="form">
                    <label for="chk" aria-hidden="true">Log in</label>
                    <input class="input" type="email" name="email" placeholder="Email" required>
                    <input class="input" type="password" name="pswd" placeholder="Password" required>
                    <button>Log in</button>
                </form>
            </div>
            <div class="register">
                <form class="form">
                    <label for="chk" aria-hidden="true">Register</label>
                    <input class="input" type="text" name="txt" placeholder="Username" required>
                    <input class="input" type="email" name="email" placeholder="Email" required>
                    <input class="input" type="password" name="pswd" placeholder="Password" required>
                    <button>Register</button>
                </form>
            </div>
        </div>
    </div>
</body>
</html>

CSS代码:

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

body {
    font-family: Verdana, Geneva, Tahoma, sans-serif;
}

.container {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #e8e8e8;
}

.main {
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: #240046;
    max-height: 450px;
    width: 400px;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: rgba(59, 0, 130, 0.442) 0px 30px 90px;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 24px;
}

/*checkbox to switch from sign up to login*/

#chk {
    display: none;
}

/*Login*/

.login {
    position: relative;
    width: 100%;
    height: 100%;
}

.login label {
    margin: 5% 0 5%;
}

label {
    color: #fff;
    font-size: 2rem;
    justify-content: center;
    display: flex;
    font-weight: bold;
    cursor: pointer;
    transition: .5s ease-in-out;
}

.input {
    width: 100%;
    height: 40px;
    font-size: 1rem;
    background: #e0dede;
    padding: 10px;
    margin-top: 15px;
    border: none;
    outline: none;
    border-radius: 4px;
}

/*Register*/

.register {
    background: #eee;
    border-radius: 60% / 10%;
    transition: .8s ease-in-out;
}

.register label {
    color: #573b8a;
    transform: scale(.6);
}

#chk:checked ~ .register {
    transform: translateY(-68%);
}

#chk:checked ~ .register label {
    transform: scale(1);
    margin-bottom: .5rem;
}

#chk:checked ~ .login label {
    transform: scale(.6);
}

/*Button*/

.form button {
    width: 70%;
    height: 40px;
    margin: 15px auto 10%;
    color: #fff;
    background: #573b8a;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: .2s ease-in;
}

.form button:hover {
    background-color: #6d44b8;
}

"

CSS发光边角效果,很炫酷,很实用

HTML代码如下:

<!DOCTYPE html>
<html>
  <head>
    <meta charset=""UTF-8"" />
    <title>CSS发光边角效果</title>
    <link rel=""stylesheet"" href=""style.css"" />
  </head>

  <body>
    <div class=""loader"" style=""--i: 1""></div>
    <div class=""loader"" style=""--i: 2""></div>
    <div class=""loader"" style=""--i: 3""></div>
    <div class=""loader"" style=""--i: 4""></div>
  </body>
</html>

CSS代码如下:

css
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #222;
  gap: 40px;
}
.loader {
  position: relative;
  width: 150px;
  height: 150px;
  background: rgba(45, 45, 45, 1);
  overflow: hidden;
  transform: rotate(calc(90deg * var(--i)));
}
.loader::before {
  content: """";
  position: absolute;
  width: 300px;
  height: 300px;
  background: radial-gradient(#0ef, transparent, transparent);
  animation: animate 1.5s linear infinite;
}
.loader::after {
  content: """";
  position: absolute;
  inset: 2px;
  background: rgba(45, 45, 45, 0.9);
}
@keyframes animate {
  0% {
    transform: translate(-150px, -150px);
  }
  25% {
    transform: translate(0px, -150px);
  }
  50% {
    transform: translate(0px, 0px);
  }
  75% {
    transform: translate(-150px, 0px);
  }
  100% {
    transform: translate(-150px, -150px);
  }
}

"单击输入框,在上方会显示一行动态的文字提示。
 title=

编写HTML代码如下:

<!DOCTYPE html>
<html>
  <head>
    <meta charset=""UTF-8"" />
    <title>使用 CSS 和 Javascript 输入文本点击动画</title>
    <link rel=""stylesheet"" href=""style.css"" />
  </head>
  <body>
    <div class=""box"">
      <input type=""text"" required />
      <label>请输入您的名字</label>
    </div>
    <script src=""script.js""></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: #29313a;
}

.box {
    position: relative;
    width: 350px;
}

.box input {
    position: relative;
    width: 100%;
    padding: 10px 0;
    background: transparent;
    border: none;
    outline: none;
    border-bottom: 2px solid #999;
    color: #fff;
    font-size: 1.25em;
    transition: 0.5s;
}

.box label {
    position: absolute;
    left: 0;
    padding: 10px 0;
    pointer-events: none;
    color: #666;
    user-select: none;
}

.box label span {
    display: inline-flex;
    font-size: 1.25em;
    letter-spacing: 0.05em;
    transition: 0.25s;
}

.box input:focus~label span,
.box input:valid~label span {
    color: #0f0;
    text-shadow: 0 0 5px #0f0,
    0 0 15px #0f0,
    0 0 30px #0f0;
    transform: translateY(-40px);
}

.box input:focus,
.box input:valid {
    border-bottom: 2px solid #fff;
}

编写Javascript代码如下:

let label = document.querySelector(""label"");

label.innerHTML = label.innerText
  .split("""")
  .map(
    (words, i) => `<span style=""transition-delay:${i * 30}ms"">${words}</span>`
  )
  .join("""");