html - 如何在 :after 伪元素中添加动画 gif
问题描述
我想使用:after
伪元素附加一个动画 gif:
#shipment-history tbody .history-row .enroute:after {
content:url(https://susscargologistics.com/wp-content/uploads/2020/04/green.gif);
clear:both;
height:20px;
width:20px;
}
我试过上面的代码。它确实显示了图像,但它不是动画的。高度和宽度也不起作用。
解决方案
您可以将 gif 用作background-image
into 伪元素,而不是在content
.
#shipment-history tbody .history-row .enroute:after {
content:'';
clear:both;
height:20px;
width:20px;
display:block;
background-image: url(https://susscargologistics.com/wp-content/uploads/2020/04/green.gif);
background-size:100%;
}
<table id="shipment-history">
<tbody>
<tr class="history-row">
<td class="enroute"></td>
</tr>
</tbody>
</table>
推荐阅读
- typescript - 在不破坏现有合约的情况下向导出类型添加函数
- go - Pass arguments with double quotes string to steps
- matlab - 在 Matlab 中表示电路
- javascript - MySQL JSON 列在 Linux 但不是 Windows 上解析
- laravel - Laravel 显示帖子的最新评论
- r - R:替换缩写词\单词
- hyperledger-fabric - 如何将自定义业务逻辑应用于 Hyperledger 上的背书策略?
- mysql - Bash Script MYSQL 从行中获取列
- c# - 在 WCF 服务 C#\ 中获取服务器端客户端的 Mac 地址
- powershell - 如何使用 PowerShell 自动登录 Chrome。我有一个使用 IE 运行但需要使用 Chrome 的脚本