html - 当 z-index 不起作用时,如何将图像放在 HTML/CSS 中的其他图像前面?
问题描述
我目前正在开发一个 HTML/CSS 和 JS 模块。
在我的代码中,我有 4 个图像absolute
。我想1 of them
移动(带有动画)in front
的the others
.
我的 HTML 代码如下所示:
<section class="bar-container">
<img id="oyster">
<img class="waves" id="wave-1">
<img class="waves" id="wave-2">
<img class="waves" id="wave-3">
<div class="progression-bar">
some stuff
</div>
</section>
我的 CSS 代码如下所示:
.bar-container {
position: relative;
}
.bar-container #oyster {
position: absolute;
left: 8.5%;
top: 38%;
animation: 2s ease infinite slideup;
transition: left 1.5s;
z-index: 4;
}
.bar-container #wave-1 {
position: absolute;
top: 60%;
left: 14%;
opacity: 1;
z-index: 3;
}
.bar-container #wave-2 {
position: absolute;
top: 60%;
left: 39%;
opacity: 1;
z-index: 2;
}
.bar-container #wave-3 {
position: absolute;
top: 60%;
left: 64%;
opacity: 1;
z-index: 1;
}
事实是我oyster
落后于海浪,我尝试了很多不同的组合,但它仍然没有像我想要的那样工作......
我真的不知道该怎么做我想做的事......有人可以帮助我吗?
解决方案
推荐阅读
- python - 硒跨刮
- excel - 将值显示为范围的组合框
- amazon-web-services - 如何实现 AWS API GATEWAY OPTIONS 方法认证?
- c# - 尝试保存 XNA Texture2D 时出错:System.Exception:“不支持纹理表面格式”
- matlab - MATLAB parfor 索引超出数组元素的数量
- python - 如何处理用yfinance下载的多级列名
- c++ - 对 C++ 构造函数删除感到困惑
- python - Python中的自定义排序顺序
- mysql - 如何在 MacOS 上重置 MySQL 或 MariaDB(使用 brew 安装)?
- python - 将多索引键转换为列