In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
这篇文章主要介绍了如何使用CSS制作水波纹效果,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
1、首先html创建新文件,定义6个div标签。
2、div盒子的class设置为".wave"给它样式设置添加元素绝对定位,语法"position:absolute;left:100px;top:150px";宽度设置为30px,高度设置为30px;给div元素添加圆角的边框border-radius属性。
代码示例
.wave{ position:absolute; top:calc((100% - 30px)/2); left:calc((100% - 30px)/2); width:30px; height:30px; border-radius:300px;}
3、div盒子的class设置为"wave0-5"给它样式设置设置图像的z-index属性;再给background-size属性指定背景图像的大小;动画animation绑定到一个元素,只要把六个div叠在一起,搭配CSS的animation,就可以让六个div依序出现。
代码示例
.wave0{ z-index:2; background-size:auto 106%; animation:w 1s forwards;}.wave1{ z-index:3; background-size:auto 102%; animation:w 1s .2s forwards;}.wave2{ z-index:4; background-size:auto 104%; animation:w 1s .4s forwards;}.wave3{ z-index:5; background-size:auto 101%; animation:w 1s .5s forwards;}.wave4{ z-index:6; background-size:auto 102%; animation:w 1s .8s forwards;}.wave5{ z-index:7; background-size:auto 100%; animation:w 1s 1s forwards;}
4、通过@keyframes规则,创建动画是通过逐步改变0%是开头动画,100%是当动画完成,注意: 使用animation属性来控制动画的外观,还使用选择器绑定动画。
@keyframes w{ 0%{ top:calc((100% - 30px)/2); left:calc((100% - 30px)/2); width:30px; height:30px; } 100%{ top:calc((100% - 300px)/2); left:calc((100% - 300px)/2); width:300px; height:300px; }
ok,代码完成
完整代码
.wave{ position:absolute; top:calc((100% - 30px)/2); left:calc((100% - 30px)/2); width:30px; height:30px; border-radius:300px; background:url(dsd.jpg); background-attachment:fixed; background-position:center center;}.wave0{ z-index:2; background-size:auto 106%; animation:w 1s forwards;}.wave1{ z-index:3; background-size:auto 102%; animation:w 1s .2s forwards;}.wave2{ z-index:4; background-size:auto 104%; animation:w 1s .4s forwards;}.wave3{ z-index:5; background-size:auto 101%; animation:w 1s .5s forwards;}.wave4{ z-index:6; background-size:auto 102%; animation:w 1s .8s forwards;}.wave5{ z-index:7; background-size:auto 100%; animation:w 1s 1s forwards;}@keyframes w{ 0%{ top:calc((100% - 30px)/2); left:calc((100% - 30px)/2); width:30px; height:30px; } 100%{ top:calc((100% - 300px)/2); left:calc((100% - 300px)/2); width:300px; height:300px; }}感谢你能够认真阅读完这篇文章,希望小编分享的"如何使用CSS制作水波纹效果"这篇文章对大家有帮助,同时也希望大家多多支持,关注行业资讯频道,更多相关知识等着你来学习!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.