How to achieve div flickering with CSS

醉折花枝作酒筹
Release: 2023-01-04 09:35:53
Original
6699 people have browsed it

In css, you can use the "@keyframes" rule and the animation attribute to achieve the div flashing effect; you only need to first use "@keyframes" to create an animation with a flashing effect; then use the animation attribute to set the time required for the animation , speed and times, etc.

How to achieve div flickering with CSS

The operating environment of this tutorial: Windows7 system, CSS3&&HTML5 version, Dell G3 computer.

The rendering is as follows

How to achieve div flickering with CSS

The code is as follows

@keyframes fade { from { opacity: 1.0; } 50% { opacity: 0.4; } to { opacity: 1.0; } } @-webkit-keyframes fade { from { opacity: 1.0; } 50% { opacity: 0.4; } to { opacity: 1.0; } } .headerBox { color: #fff; padding: 10px; font-size: 15px; height: 60px; animation: fade 600ms infinite; -webkit-animation: fade 600ms infinite; }
Copy after login

Just set the headerBox style to the div

Recommended learning:css video tutorial

The above is the detailed content of How to achieve div flickering with CSS. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!