html - 为什么 animate.css 仅适用于 DIV 元素
问题描述
我使用该animate.css
库很长时间并且效果很好,但今天我发现它不适用于SPAN
或任何其他不是DIV
. 有谁知道原因以及我该如何解决?
检查下面的非常简单的示例(代码如下):
https://jsfiddle.net/214gdyrw/
当您打开上面的链接时,您可以看到它AAA
并CCC
自动制作动画(在页面加载时),但bbb
不会。唯一的区别是一个是div
,另一个是span
。我怎样才能使span
也动画?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- Animate.css -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css" />
</head>
<body>
<div class="animated bounce">AAA</div>
<span class="animated bounce">bbb</span>
<div class="animated bounce">CCC</div>
</body>
</html>
解决方案
添加display: inline-block
在span
.
这将解决您的问题。
元素需要具有块行为,而不是内联。
推荐阅读
- testng - 在 TestNG 中禁用并行执行 - 版本 6.14
- java - spring data jpa中的自定义方法是如何实现和执行的?
- r - 使用 fread 读取 .csv 适用于 OSX 而不是 Windows
- javascript - 将日期保存到基础 | 在 Ant Design 的 Date Picker 中格式化日期
- javascript - Jquery ajax requesting not working in FF and safari, working in chrome
- java - Java中Service/Rest方法的集成测试
- java - 使用 Java 反射从 getMethod 获取 NoSuchMethodException
- callback - Javascript 和回调函数
- vba - 我创建数据透视的代码有效,但第一行字段无效
- vba - 想要 VBA 宏 - 循环将数据从一张表复制到另一张表