html - 波纹效果动画在我的 HTML 代码中不起作用
问题描述
这是我的 HTML 代码,它位于 body 标记中。HTML 代码:
<div calss="wapper">
<div class="box">
<span class="animate"></span>
<div class="img-area">
<img src="../picture/pic1.jpeg" alt="">
</div>
<h2>Abu Jafor</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aut, sequi.</p>
<p class="social">
<i class="fa fa-youtube"></i>
<i class="fa fa-linkedin"></i>
<i class="fa fa-twitter"></i>
</p>
</div>
CSS 代码:
.animation 是我的动画类名。它不会影响我的 HTML 代码。
.animate{
width: 5px;
height: 5px;
background: rgba(255, 255, 255,, 0.1);
display: inline-block;
border-radius: 100%;
animation: ripple 0.6s linear infinite;
}
@@keyframes ripple {
0%{
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.1),
0 0 0 60px rgba(255, 255, 255, 0.1),
0 0 0 120px rgba(255, 255, 255, 0.1),
0 0 0 180px rgba(255, 255, 255, 0.1);
}
100%{
box-shadow: 0 0 0 20 rgba(255, 255, 255, 0.1),
0 0 0 120px rgba(255, 255, 255, 0.1),
0 0 0 240px rgba(255, 255, 255, 0.1),
0 0 0 360px rgba(255, 255, 255, 0.1);
}
}
你能帮我找出问题吗?
解决方案
请试试这个,
编辑:
@@keyframes{...}
波纹变化以@keyframes ripple{...}
消除额外的@
<div calss="wapper">
更改类的拼写。- 添加
ease-in-out
到平滑过渡 alternate;
动画先向前播放,再向后播放- 给body加一个背景,就是
body{background:#888;}
知道涟漪效应。
animation: ripple 0.6s ease-in-out infinite alternate;
.animate{
width: 15px;
height: 15px;
background: rgba(255, 255, 255,, 0.1);
display: inline-block;
border-radius: 100%;
animation: ripple 0.6s ease-in-out infinite alternate;
}
body{
background:#888;
}
@keyframes ripple {
0%{
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.1),
0 0 0 60px rgba(255, 255, 255, 0.1),
0 0 0 120px rgba(255, 255, 255, 0.1),
0 0 0 180px rgba(255, 255, 255, 0.1);
}
100%{
box-shadow: 0 0 0 20 rgba(255, 255, 255, 0.1),
0 0 0 120px rgba(255, 255, 255, 0.1),
0 0 0 240px rgba(255, 255, 255, 0.1),
0 0 0 360px rgba(255, 255, 255, 0.1);
}
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="wapper">
<div class="box">
<span class="animate"></span>
<div class="img-area">
<img src="https://dummyimage.com/50x50/00ff00/fff&text=Logo" alt="">
</div>
<h2>Abu Jafor</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aut, sequi.</p>
<p class="social">
<i class="fa fa-youtube"></i>
<i class="fa fa-linkedin"></i>
<i class="fa fa-twitter"></i>
</p>
</div>
</div>
推荐阅读
- image - 有没有办法在后台运行虚拟机,而应用程序在 VM 中运行,需要光标?
- javascript - 运行一堆承诺,但等待下一个被执行,直到先例解决
- c# - c#: 使用 bool = !bool 出现奇怪的模式
- python - Python 熊猫 KeyError
- r - 如何使用 R 中的 Kable 在乳胶文档的单个单元格中的文本前面添加空格?
- python - 使用 pynput 获取鼠标位置
- android - Android - 无法为应用特定存储中的文件打开 FileOutputStream
- winforms - 错误:browser_gpu_channel_host_factory.cc(167)] 无法在 CefSharp 中启动 GPU 进程
- javascript - Javascript - 如何从正则表达式而不是 [Object object] 返回字符串
- makefile - make 中的 HISMAKEFILE 变量是什么