css+svg实现文字点击拆分变成导航条动画效果代码

代码语言:html

所属分类:动画

代码描述:css+svg实现文字点击拆分变成导航条动画效果代码

代码标签: css svg 文字 点击 拆分 导航条 动画

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


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

<head>

  <meta charset="UTF-8">
  

  <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
  
  
  
<style>
/* Transitions aren't quite as smooth on firefox */

:root {
  --gradient: conic-gradient(
    from 240deg at 50% 50%,
    #00ffc3,
    #00fad9,
    #00f4f0,
    #00eeff,
    #00e6ff,
    #00dcff,
    #00d2ff,
    #00c5ff,
    #00b8ff,
    #6da8ff,
    #9f97ff,
    #c285ff
  );
}

*
, *::before
, *::after {
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
}

body
, html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  margin: 0;
  font-size: 100%;
  background: black;
  color: white;
}

input {
  display: none;
}

#welcomeMessage {
  font-size: 130%;
}

#welcomeMessage
, #welcomeMessage
  figcaption
, #welcomeMessage
  figcaption
  h1
, #welcomeMessage
  figcaption
  h1
  b {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
}

#welcomeMessage
figcaption {
  width: auto;
  z-index: 1;
}

#welcomeMessage
figcaption::before
, #welcomeMessage
  figcaption::after {
    position: absolute;
    background: #222;
    width: 0%;
    height: 0%;
    content: "";
    z-index: -1;
}

#welcomeMessage
figcaption::after {
  background: var(--gradient);
  width: calc(100% + 3.1em);
  height: calc(100% + 3.1em);
  z-index: -2;
}

#welcomeMessage
figcaption
h1 {
  text-transform: lowercase;
  background: #555;
  box-shadow: rgba(0, 0, 0, 0.19) 0px 0.625em 1.25em, rgba(0, 0, 0, 0.23) 0px 0.375em 0.375em;
  transition: all 0.1s ease-in-out;
}

#welcomeMessage
figcaption
h1:active {
  transform: scale(0.93);
  transition: all 0.05s ease-in-out;
}

#welcomeMessage
figcaption
h1::before
, #welcomeMessage
  figcaption
  h1::after {
    position: absolute;
    white-space: nowrap;
    font-size: 0.7em;
    font-weight: 200;
    transition: all 0.7s ease-in-out;
}

#welcomeMessage
figcaption
h1::before {
  top: -4.3em;
  right: 2em;
  content: &.........完整代码请登录后点击上方下载按钮下载查看

网友评论0