Let’s take a look at the renderings first:
(Recommended video tutorial: css video tutorial)
Code implementation:
<!DOCTYPE html> <html> <head> <style> @keyframes fade { from { opacity: 1.0; } 50% { opacity: 0.0; } to { opacity: 1.0; } } .headerBox { width:100px; background: #ff0; padding: 10px; font-size: 15px; height: 100px; animation: fade 600ms infinite; } </style> </head> <body> <div> </div> </body> </html>
Recommended tutorial: CSS tutorial
The above is the detailed content of css to achieve div background color flashing effect. For more information, please follow other related articles on the PHP Chinese website!