一个网页控件的呼吸灯效果实例 分享

本文介绍了一种使用CSS实现的呼吸灯效果,通过动画控制元素的透明度和阴影变化,达到渐变的点亮与变暗的效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

呼吸灯效果实现,控件的呼吸灯效果

网页源码:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<style type="text/css">
.breathe-btn{ position:relative; width:100px; height:10px; margin:40px auto; line-height:40px; border:1px solid #2b92d4; border-radius:5px; color:#fff; font-size:20px; text-align:center; cursor:pointer; box-shadow:0 1px 2px rgba(0,0,0,.3); overflow:hidden; background-image: -webkit-gradient(linear, left top, left bottom, from(#6cc3fe), to(#21a1d0));
    -webkit-animation-timing-function: ease-in-out;
    -webkit-animation-name: breathe;
    -webkit-animation-duration: 2700ms;
    -webkit-animation-iteration-count: infinite;
    -webkit-animation-direction: alternate;
}
@-webkit-keyframes breathe {
    0% { opacity: .2; box-shadow:0 1px 2px rgba(255,255,255,0.1);}
    100% { opacity: 1; border:1px solid rgba(59,235,235,1); box-shadow:0 1px 30px rgba(59,255,255,1);}
}
</style>
</head>
<body>
<div class="breathe-btn"></div>
</body>
</html>
	


效果图:

                                            》》》     


图像是渐变的点亮与变暗。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值