【发布时间】:2019-06-27 05:43:41
【问题描述】:
我正在尝试使用引导程序和 css 将文本集中在多个图像上。大多数谷歌搜索说我需要使用 position: absolute; 然而,我能做的最多是将文本放在屏幕中间而不是图像上方。我相信它与引导程序有关,但我找不到阻止它的原因 目标是让文本在图像上具有动画效果,例如淡入等
我已经检查了多篇关于此的帖子,但它们似乎都只有在一张图片时才有效。尝试处理多个图像似乎需要不同的方法
编辑: 由于这被标记为重复,我想指出另一篇文章只显示这个使用一个图像。当涉及到多个图像时,另一个帖子不起作用
有问题的代码部分:
.imgText {
position: absolute;
z-index: -1;
}
.imgList {
z-index: -2;
}
<div class="row justify-content-center mt-3">
<div class="ml-4 imgList">
<img src="https://via.placeholder.com/200x200">
<div class="imgText justify-content-center m-auto">
test text
</div>
</div>
<div class="ml-4 imgList">
<img src="https://via.placeholder.com/200x200">
<div class="imgText justify-content-center m-auto">
test text
</div>
</div>
</div>
您可以在此处查看实时结果 https://jsfiddle.net/nicholascox2/o29n78dL/61/
【问题讨论】:
标签: html css bootstrap-4