CSS3의 멋진 빛나는 텍스트를 사용하여 텍스트 색상을 사용자 정의하는 방법

高洛峰
풀어 주다: 2017-03-19 16:47:47
원래의
2028명이 탐색했습니다.

이것은 순수 CSS3를 기반으로 한 텍스트 빛나는 효과입니다. 텍스트 위에 마우스를 올리면 텍스트가 빛나는 애니메이션을 시뮬레이션하여 매우 멋진 빛나는 그림을 보여줍니다. 또한, 특수 글꼴의 참조로 인해 전체 텍스트 효과가 3D 입체 효과처럼 보입니다. 네트워크에서 이러한 글꼴을 로드할 수 없는 경우 Google의 글꼴 라이브러리 URL이 차단된 것처럼 외국 웹사이트가 차단되었기 때문일 수 있습니다. .

CSS3의 멋진 빛나는 텍스트를 사용하여 텍스트 색상을 사용자 정의하는 방법

HTML 코드

<p id="container">

  <p><a href="#">
    RED
  </a></p>

  <p><a href="#">
    BLUE
  </a></p>

  <p><a href="#">
    Yellow
  </a></p>

  <p><a href="#">
    GREEN
  </a></p>

  <p><a href="#">
    ORANGE
  </a></p>

  <p><a href="#">
    VIOLET
  </a></p>

</p>
로그인 후 복사

CSS 코드

/*setup*/
*{
  margin: 0;
  padding: 0;
}

@font-face {
  font-family: &#39;Monoton&#39;;
  font-style: normal;
  font-weight: 400;
  src: local(&#39;Monoton&#39;), local(&#39;Monoton-Regular&#39;), url(http://themes.googleusercontent.com/static/fonts/monoton/v4/AKI-lyzyNHXByGHeOcds_w.woff) format(&#39;woff&#39;);
}

@font-face {
  font-family: &#39;Iceland&#39;;
  font-style: normal;
  font-weight: 400;
  src: local(&#39;Iceland&#39;), local(&#39;Iceland-Regular&#39;), url(http://themes.googleusercontent.com/static/fonts/iceland/v3/F6LYTZLHrG9BNYXRjU7RSw.woff) format(&#39;woff&#39;);
}

@font-face {
  font-family: &#39;Pacifico&#39;;
  font-style: normal;
  font-weight: 400;
  src: local(&#39;Pacifico Regular&#39;), local(&#39;Pacifico-Regular&#39;), url(http://themes.googleusercontent.com/static/fonts/pacifico/v5/yunJt0R8tCvMyj_V4xSjafesZW2xOQ-xsNqO47m55DA.woff) format(&#39;woff&#39;);
}

@font-face {
  font-family: &#39;PressStart&#39;;
  font-style: normal;
  font-weight: 400;
  src: local(&#39;Press Start 2P&#39;), local(&#39;PressStart2P-Regular&#39;), url(http://themes.googleusercontent.com/static/fonts/pressstart2p/v2/8Lg6LX8-ntOHUQnvQ0E7o3dD2UuwsmbX3BOp4SL_VwM.woff) format(&#39;woff&#39;);
}

@font-face {
  font-family: &#39;Audiowide&#39;;
  font-style: normal;
  font-weight: 400;
  src: local(&#39;Audiowide&#39;), local(&#39;Audiowide-Regular&#39;), url(http://themes.googleusercontent.com/static/fonts/audiowide/v2/8XtYtNKEyyZh481XVWfVOj8E0i7KZn-EPnyo3HZu7kw.woff) format(&#39;woff&#39;);
}

@font-face {
  font-family: &#39;Vampiro One&#39;;
  font-style: normal;
  font-weight: 400;
  src: local(&#39;Vampiro One&#39;), local(&#39;VampiroOne-Regular&#39;), url(http://themes.googleusercontent.com/static/fonts/vampiroone/v3/Ho2Xld8UbQyBA8XLxF1_NYbN6UDyHWBl620a-IRfuBk.woff) format(&#39;woff&#39;);
}

body{
  background-color: #222222;
}

#container{

  margin:auto;
}

/*neeeeoooon*/
p{
  text-align:center;
  font-size:7em;
  margin:20px 0 20px 0; 
}

a{
  text-decoration:none; 
  -webkit-transition: all 0.5s;
  -moz-transition: all 0.5s;
  transition: all 0.5s;
}

p:nth-child(1) a{
  color:#FF1177;
  font-family:Monoton;
}
p:nth-child(1) a:hover{
  -webkit-animation: neon1 1.5s ease-in-out infinite alternate;
  -moz-animation: neon1 1.5s ease-in-out infinite alternate;
  animation: neon1 1.5s ease-in-out infinite alternate; 
}

p:nth-child(2) a{
  font-size:1.5em;
  color:#228DFF;
  font-family:Iceland;
}
p:nth-child(2) a:hover{
  -webkit-animation: neon2 1.5s ease-in-out infinite alternate;
  -moz-animation: neon2 1.5s ease-in-out infinite alternate;
  animation: neon2 1.5s ease-in-out infinite alternate;
}

p:nth-child(3) a{
  color:#FFDD1B;
  font-family:Pacifico;
}
p:nth-child(3) a:hover{ 
  -webkit-animation: neon3 1.5s ease-in-out infinite alternate;
  -moz-animation: neon3 1.5s ease-in-out infinite alternate;
  animation: neon3 1.5s ease-in-out infinite alternate; 
}

p:nth-child(4) a{
  color:#B6FF00;
  font-family:PressStart;
  font-size:0.8em;
}
p:nth-child(4) a:hover{
  -webkit-animation: neon4 1.5s ease-in-out infinite alternate;
  -moz-animation: neon4 1.5s ease-in-out infinite alternate;
  animation: neon4 1.5s ease-in-out infinite alternate;
}

p:nth-child(5) a{
  color:#FF9900;
  font-family:Audiowide;
}
p:nth-child(5) a:hover{
  -webkit-animation: neon5 1.5s ease-in-out infinite alternate;
  -moz-animation: neon5 1.5s ease-in-out infinite alternate;
  animation: neon5 1.5s ease-in-out infinite alternate; 
}

p:nth-child(6) a{
  color:#BA01FF;
  font-family:Vampiro One;
}
p:nth-child(6) a:hover{
  -webkit-animation: neon6 1.5s ease-in-out infinite alternate;
  -moz-animation: neon6 1.5s ease-in-out infinite alternate;
  animation: neon6 1.5s ease-in-out infinite alternate;
}

p a:hover{
color:#ffffff;  
}

/*glow for webkit*/
@-webkit-keyframes neon1 {
  from {
    text-shadow: 0 0 10px #fff,
               0 0 20px  #fff,
               0 0 30px  #fff,
               0 0 40px  #FF1177,
               0 0 70px  #FF1177,
               0 0 80px  #FF1177,
               0 0 100px #FF1177,
               0 0 150px #FF1177;
  }
  to {
    text-shadow: 0 0 5px #fff,
               0 0 10px #fff,
               0 0 15px #fff,
               0 0 20px #FF1177,
               0 0 35px #FF1177,
               0 0 40px #FF1177,
               0 0 50px #FF1177,
               0 0 75px #FF1177;
  }
}

@-webkit-keyframes neon2 {
  from {
    text-shadow: 0 0 10px #fff,
               0 0 20px  #fff,
               0 0 30px  #fff,
               0 0 40px  #228DFF,
               0 0 70px  #228DFF,
               0 0 80px  #228DFF,
               0 0 100px #228DFF,
               0 0 150px #228DFF;
  }
  to {
    text-shadow: 0 0 5px #fff,
               0 0 10px #fff,
               0 0 15px #fff,
               0 0 20px #228DFF,
               0 0 35px #228DFF,
               0 0 40px #228DFF,
               0 0 50px #228DFF,
               0 0 75px #228DFF;
  }
}

@-webkit-keyframes neon3 {
  from {
    text-shadow: 0 0 10px #fff,
               0 0 20px  #fff,
               0 0 30px  #fff,
               0 0 40px  #FFDD1B,
               0 0 70px  #FFDD1B,
               0 0 80px  #FFDD1B,
               0 0 100px #FFDD1B,
               0 0 150px #FFDD1B;
  }
  to {
    text-shadow: 0 0 5px #fff,
               0 0 10px #fff,
               0 0 15px #fff,
               0 0 20px #FFDD1B,
               0 0 35px #FFDD1B,
               0 0 40px #FFDD1B,
               0 0 50px #FFDD1B,
               0 0 75px #FFDD1B;
  }
}

@-webkit-keyframes neon4 {
  from {
    text-shadow: 0 0 10px #fff,
               0 0 20px  #fff,
               0 0 30px  #fff,
               0 0 40px  #B6FF00,
               0 0 70px  #B6FF00,
               0 0 80px  #B6FF00,
               0 0 100px #B6FF00,
               0 0 150px #B6FF00;
  }
  to {
    text-shadow: 0 0 5px #fff,
               0 0 10px #fff,
               0 0 15px #fff,
               0 0 20px #B6FF00,
               0 0 35px #B6FF00,
               0 0 40px #B6FF00,
               0 0 50px #B6FF00,
               0 0 75px #B6FF00;
  }
}

@-webkit-keyframes neon5 {
  from {
    text-shadow: 0 0 10px #fff,
               0 0 20px  #fff,
               0 0 30px  #fff,
               0 0 40px  #FF9900,
               0 0 70px  #FF9900,
               0 0 80px  #FF9900,
               0 0 100px #FF9900,
               0 0 150px #FF9900;
  }
  to {
    text-shadow: 0 0 5px #fff,
               0 0 10px #fff,
               0 0 15px #fff,
               0 0 20px #FF9900,
               0 0 35px #FF9900,
               0 0 40px #FF9900,
               0 0 50px #FF9900,
               0 0 75px #FF9900;
  }
}

@-webkit-keyframes neon6 {
  from {
    text-shadow: 0 0 10px #fff,
               0 0 20px #fff,
               0 0 30px #fff,
               0 0 40px #ff00de,
               0 0 70px #ff00de,
               0 0 80px #ff00de,
               0 0 100px #ff00de,
               0 0 150px #ff00de;
  }
  to {
    text-shadow: 0 0 5px #fff,
               0 0 10px #fff,
               0 0 15px #fff,
               0 0 20px #ff00de,
               0 0 35px #ff00de,
               0 0 40px #ff00de,
               0 0 50px #ff00de,
               0 0 75px #ff00de;
  }
}

/*glow for mozilla*/
@-moz-keyframes neon1 {
  from {
    text-shadow: 0 0 10px #fff,
               0 0 20px  #fff,
               0 0 30px  #fff,
               0 0 40px  #FF1177,
               0 0 70px  #FF1177,
               0 0 80px  #FF1177,
               0 0 100px #FF1177,
               0 0 150px #FF1177;
  }
  to {
    text-shadow: 0 0 5px #fff,
               0 0 10px #fff,
               0 0 15px #fff,
               0 0 20px #FF1177,
               0 0 35px #FF1177,
               0 0 40px #FF1177,
               0 0 50px #FF1177,
               0 0 75px #FF1177;
  }
}

@-moz-keyframes neon2 {
  from {
    text-shadow: 0 0 10px #fff,
               0 0 20px  #fff,
               0 0 30px  #fff,
               0 0 40px  #228DFF,
               0 0 70px  #228DFF,
               0 0 80px  #228DFF,
               0 0 100px #228DFF,
               0 0 150px #228DFF;
  }
  to {
    text-shadow: 0 0 5px #fff,
               0 0 10px #fff,
               0 0 15px #fff,
               0 0 20px #228DFF,
               0 0 35px #228DFF,
               0 0 40px #228DFF,
               0 0 50px #228DFF,
               0 0 75px #228DFF;
  }
}

@-moz-keyframes neon3 {
  from {
    text-shadow: 0 0 10px #fff,
               0 0 20px  #fff,
               0 0 30px  #fff,
               0 0 40px  #FFDD1B,
               0 0 70px  #FFDD1B,
               0 0 80px  #FFDD1B,
               0 0 100px #FFDD1B,
               0 0 150px #FFDD1B;
  }
  to {
    text-shadow: 0 0 5px #fff,
               0 0 10px #fff,
               0 0 15px #fff,
               0 0 20px #FFDD1B,
               0 0 35px #FFDD1B,
               0 0 40px #FFDD1B,
               0 0 50px #FFDD1B,
               0 0 75px #FFDD1B;
  }
}

@-moz-keyframes neon4 {
  from {
    text-shadow: 0 0 10px #fff,
               0 0 20px  #fff,
               0 0 30px  #fff,
               0 0 40px  #B6FF00,
               0 0 70px  #B6FF00,
               0 0 80px  #B6FF00,
               0 0 100px #B6FF00,
               0 0 150px #B6FF00;
  }
  to {
    text-shadow: 0 0 5px #fff,
               0 0 10px #fff,
               0 0 15px #fff,
               0 0 20px #B6FF00,
               0 0 35px #B6FF00,
               0 0 40px #B6FF00,
               0 0 50px #B6FF00,
               0 0 75px #B6FF00;
  }
}

@-moz-keyframes neon5 {
  from {
    text-shadow: 0 0 10px #fff,
               0 0 20px  #fff,
               0 0 30px  #fff,
               0 0 40px  #FF9900,
               0 0 70px  #FF9900,
               0 0 80px  #FF9900,
               0 0 100px #FF9900,
               0 0 150px #FF9900;
  }
  to {
    text-shadow: 0 0 5px #fff,
               0 0 10px #fff,
               0 0 15px #fff,
               0 0 20px #FF9900,
               0 0 35px #FF9900,
               0 0 40px #FF9900,
               0 0 50px #FF9900,
               0 0 75px #FF9900;
  }
}

@-moz-keyframes neon6 {
  from {
    text-shadow: 0 0 10px #fff,
               0 0 20px #fff,
               0 0 30px #fff,
               0 0 40px #ff00de,
               0 0 70px #ff00de,
               0 0 80px #ff00de,
               0 0 100px #ff00de,
               0 0 150px #ff00de;
  }
  to {
    text-shadow: 0 0 5px #fff,
               0 0 10px #fff,
               0 0 15px #fff,
               0 0 20px #ff00de,
               0 0 35px #ff00de,
               0 0 40px #ff00de,
               0 0 50px #ff00de,
               0 0 75px #ff00de;
  }
}

/*glow*/
@keyframes neon1 {
  from {
    text-shadow: 0 0 10px #fff,
               0 0 20px  #fff,
               0 0 30px  #fff,
               0 0 40px  #FF1177,
               0 0 70px  #FF1177,
               0 0 80px  #FF1177,
               0 0 100px #FF1177,
               0 0 150px #FF1177;
  }
  to {
    text-shadow: 0 0 5px #fff,
               0 0 10px #fff,
               0 0 15px #fff,
               0 0 20px #FF1177,
               0 0 35px #FF1177,
               0 0 40px #FF1177,
               0 0 50px #FF1177,
               0 0 75px #FF1177;
  }
}

@keyframes neon2 {
  from {
    text-shadow: 0 0 10px #fff,
               0 0 20px  #fff,
               0 0 30px  #fff,
               0 0 40px  #228DFF,
               0 0 70px  #228DFF,
               0 0 80px  #228DFF,
               0 0 100px #228DFF,
               0 0 150px #228DFF;
  }
  to {
    text-shadow: 0 0 5px #fff,
               0 0 10px #fff,
               0 0 15px #fff,
               0 0 20px #228DFF,
               0 0 35px #228DFF,
               0 0 40px #228DFF,
               0 0 50px #228DFF,
               0 0 75px #228DFF;
  }
}

@keyframes neon3 {
  from {
    text-shadow: 0 0 10px #fff,
               0 0 20px  #fff,
               0 0 30px  #fff,
               0 0 40px  #FFDD1B,
               0 0 70px  #FFDD1B,
               0 0 80px  #FFDD1B,
               0 0 100px #FFDD1B,
               0 0 150px #FFDD1B;
  }
  to {
    text-shadow: 0 0 5px #fff,
               0 0 10px #fff,
               0 0 15px #fff,
               0 0 20px #FFDD1B,
               0 0 35px #FFDD1B,
               0 0 40px #FFDD1B,
               0 0 50px #FFDD1B,
               0 0 75px #FFDD1B;
  }
}

@keyframes neon4 {
  from {
    text-shadow: 0 0 10px #fff,
               0 0 20px  #fff,
               0 0 30px  #fff,
               0 0 40px  #B6FF00,
               0 0 70px  #B6FF00,
               0 0 80px  #B6FF00,
               0 0 100px #B6FF00,
               0 0 150px #B6FF00;
  }
  to {
    text-shadow: 0 0 5px #fff,
               0 0 10px #fff,
               0 0 15px #fff,
               0 0 20px #B6FF00,
               0 0 35px #B6FF00,
               0 0 40px #B6FF00,
               0 0 50px #B6FF00,
               0 0 75px #B6FF00;
  }
}

@keyframes neon5 {
  from {
    text-shadow: 0 0 10px #fff,
               0 0 20px  #fff,
               0 0 30px  #fff,
               0 0 40px  #FF9900,
               0 0 70px  #FF9900,
               0 0 80px  #FF9900,
               0 0 100px #FF9900,
               0 0 150px #FF9900;
  }
  to {
    text-shadow: 0 0 5px #fff,
               0 0 10px #fff,
               0 0 15px #fff,
               0 0 20px #FF9900,
               0 0 35px #FF9900,
               0 0 40px #FF9900,
               0 0 50px #FF9900,
               0 0 75px #FF9900;
  }
}

@keyframes neon6 {
  from {
    text-shadow: 0 0 10px #fff,
               0 0 20px #fff,
               0 0 30px #fff,
               0 0 40px #ff00de,
               0 0 70px #ff00de,
               0 0 80px #ff00de,
               0 0 100px #ff00de,
               0 0 150px #ff00de;
  }
  to {
    text-shadow: 0 0 5px #fff,
               0 0 10px #fff,
               0 0 15px #fff,
               0 0 20px #ff00de,
               0 0 35px #ff00de,
               0 0 40px #ff00de,
               0 0 50px #ff00de,
               0 0 75px #ff00de;
  }
}

/*REEEEEEEEEEESPONSIVE*/
@media (max-width: 650px) {

  #container{
    width: 100%;
  }

  p{
    font-size:3.5em;
  }

}
로그인 후 복사

위 내용은 CSS3의 멋진 빛나는 텍스트를 사용하여 텍스트 색상을 사용자 정의하는 방법의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿