Home >Web Front-end >CSS Tutorial >css to achieve div background color flashing effect

css to achieve div background color flashing effect

王林
王林forward
2020-10-27 17:27:136371browse

css to achieve div background color flashing effect

Let’s take a look at the renderings first:

(Recommended video tutorial: css video tutorial)

css to achieve div background color flashing effect

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!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete