search
HomeWeb Front-endCSS TutorialHow to use css3+html5 to create text neon effect (pay full code)

Today, with the increasing development of science and technology, people are becoming more and more picky about aesthetics. This requires us to be more rigorous in our attitude towards front-end development and at the same time, we need to add fresh elements to achieve the purpose of attracting attention. So today this article will show you how to use css3 html5 to create text neon effects. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Features of using css3 html5 to create text neon effects

  1. The text has a flashing neon animation, and the text There are also cool animated special effects when selected;

  2. text can be input dynamically, and the input text is rendered with neon light effects in real time.

Steps to use css3 html5 to create text neon effect

  1. Enter the text that needs to be added with special effects.

  2. Use the multi-layer shadow properties of box-shadow to draw the three-dimensional effect of neon tubes.

  3. Use text-shadow multi-layer shadow to draw text tubes, emit light, and project, to achieve the effect of setting three-dimensional text.

  4. Here we focus on the principle of achieving the neon flashing effect

    We need to set two labels on the text and make them completely overlap , the upper layer implements the lamp effect, the lower layer implements the halo effect, and then uses the selector to make it flash continuously. At the same time, we need to set the text-shadow attribute values ​​​​of the two states of off and on, so that they switch at different speeds, forming A neon flashing effect.

Note: If you don’t understand the above content, you can check other articles on this site

How to use css3 to achieve Simple shadow effect of pictures (complete code attached)

How to use css3 to achieve the glow effect within fonts (detailed explanation)

Use css3 The code for creating text neon light effect using html5

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>css3 html5文字霓虹灯交替闪烁效果</title>
<style>html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
  display: block;
}
body {
  line-height: 1;
}
ol, ul {
  list-style: none;
}
blockquote, q {
  quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
  content: &#39;&#39;;
  content: none;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}
  body {
  background-color: #222;
  background-image: -webkit-radial-gradient(circle, #333, #222, #111);
  background-attachment: fixed;
  overflow: hidden;
  font-family: &#39;Wire One&#39;, sans-serif;
  font-size: 6em;
  color: #FFF;
  line-height: normal;
  text-align: center;
}
#glow {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
  height: 1em;
  margin: auto;
  display: block;
}
#glow p,
#glow span{
  display: inline-block;
  color: #FFF;
  text-shadow: 0 0 15px;
}
#glow p:nth-child(odd) {
  -webkit-animation: bglow .3s ease infinite;
}
#glow p:nth-child(even) {
  -webkit-animation: rglow .3s ease infinite;
}
@-webkit-keyframes bglow {
  0% {
    color: rgb(0, 135, 211);
    text-shadow: 0 0 15px;
  }
}
@-webkit-keyframes rglow {
  100% {
    color: rgb(233, 54, 40);
    text-shadow: 0 0 15px;
  }
}
  </style>
  <script>
    window.confirm = function(){};
    window.prompt  = function(){};
    window.open    = function(){};
    window.print   = function(){};
    // Support hover state for mobile.
    if (false) {
      window.ontouchstart = function(){};
    }
  </script>
</head>
<body>
  <section id="glow">
  <p>P</p>
  <p>H</p>
  <p>P</p>
  <p>中</p>
  <p>文</p>
  <p>网</p>
</section>
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
  <script>
    if (document.location.search.match(/type=embed/gi)) {
      window.parent.postMessage(&#39;resize&#39;, "*");
    }
  </script>
</body>
</html>

The text neon light effect is as shown in the picture

How to use css3+html5 to create text neon effect (pay full code)

Summary

#At first I thought the text neon effect was a gif animation or something like that, but after reviewing the elements I found that it actually used html5 The implementation of CSS3 animation immediately aroused my (hao) desire (qi) desire (xin), and I decided to find out. After checking the code, I found that the principle is so simple. I hope the content of this article can help everyone.

The above is the detailed content of How to use css3+html5 to create text neon effect (pay full code). For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How much specificity do @rules have, like @keyframes and @media?How much specificity do @rules have, like @keyframes and @media?Apr 18, 2025 am 11:34 AM

I got this question the other day. My first thought is: weird question! Specificity is about selectors, and at-rules are not selectors, so... irrelevant?

Can you nest @media and @support queries?Can you nest @media and @support queries?Apr 18, 2025 am 11:32 AM

Yes, you can, and it doesn't really matter in what order. A CSS preprocessor is not required. It works in regular CSS.

Quick Gulp Cache BustingQuick Gulp Cache BustingApr 18, 2025 am 11:23 AM

You should for sure be setting far-out cache headers on your assets like CSS and JavaScript (and images and fonts and whatever else). That tells the browser

In Search of a Stack That Monitors the Quality and Complexity of CSSIn Search of a Stack That Monitors the Quality and Complexity of CSSApr 18, 2025 am 11:22 AM

Many developers write about how to maintain a CSS codebase, yet not a lot of them write about how they measure the quality of that codebase. Sure, we have

Datalist is for suggesting values without enforcing valuesDatalist is for suggesting values without enforcing valuesApr 18, 2025 am 11:08 AM

Have you ever had a form that needed to accept a short, arbitrary bit of text? Like a name or whatever. That's exactly what is for. There are lots of

Front Conference in ZürichFront Conference in ZürichApr 18, 2025 am 11:03 AM

I'm so excited to be heading to Zürich, Switzerland for Front Conference (Love that name and URL!). I've never been to Switzerland before, so I'm excited

Building a Full-Stack Serverless Application with Cloudflare WorkersBuilding a Full-Stack Serverless Application with Cloudflare WorkersApr 18, 2025 am 10:58 AM

One of my favorite developments in software development has been the advent of serverless. As a developer who has a tendency to get bogged down in the details

Creating Dynamic Routes in a Nuxt ApplicationCreating Dynamic Routes in a Nuxt ApplicationApr 18, 2025 am 10:53 AM

In this post, we’ll be using an ecommerce store demo I built and deployed to Netlify to show how we can make dynamic routes for incoming data. It’s a fairly

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment