在CSS不透明度上执行动画
要使用CSS在opacity属性上实现动画,您可以尝试运行以下代码:
示例
<!DOCTYPE html>
<html>
<head>
<style>
#demo1 {
position: absolute;
top: 60px;
width: 300px;
height: 150px;
background-color: lightblue;
animation: myanim 4s infinite;
}
#demo2 {
position: absolute;
top: 90px;
left: 30px;
width: 300px;
height: 150px;
background-color: orange;
animation: myanim 3s infinite;
}
#demo3 {
position: absolute;
top: 120px;
left: 60px;
width: 350px;
height: 150px;
background-color: coral;
}
@keyframes myanim {
30% {
opacity: 0.4;
}
}
</style>
</head>
<body>
<p>Showing opacity</p>
<div id = "demo1"><h1>End div</h1></div>
<div id = "demo2"></div>
<div id = "demo3"><h1>Start div</h1></div>
</body>
</html>热门推荐
7 薛之谦祝福语简短
10 五十二新年祝福语简短
11 舞台上祝福语大全简短
12 日常祝福语简短语客户
13 宝宝新年祝福语大全简短
14 岁岁祝福语简短独特
15 朋友弟弟生日祝福语简短
16 贺卡祝福语情侣搞笑简短
17 冬季祝福语大全 简短的
18 升职祝福语朋友简短精辟