html - Div HTML element is hiding behind an Image
问题描述
Actually I I created an Image Slider using HTML and CSS. And I wanted to create a popup box. So before adding the functonality I created a layout for it and tried to make it in center. So when I write position:relative; bottom:300px(or whatever)it goes up but hides behind the image Slider.
.popup{
width: 900px;
height: 500px;
background-color: white;
border: 5px solid black;
position: relative;
bottom:0px;
}
<div id="slider">
<figure>
<img src="img3.jpg">
<img src="3.JPG">
<img src="4.JPG">
<img src="img3.jpg">
<img src="9.jpg" alt="">
</figure>
</div>
<center>
<div class="popup">
Dummy Text
</div>
</center>
解决方案
使用 z-index 指定您想要在顶部的元素:
推荐阅读
- docker - goreleaser 用于合并到 master 和用于切割发布的单独流程
- c# - 为什么它不显示我在 DataTable 中分配的 DataGrid 中的值?
- c++ - 如何制作一个 bool 数组来保存二维数组中大于 0 的数字的位置?
- gpu - 如何在 Colab 中获得 V100 GPU?
- java - 图形不会自动移动,并且在按下箭头键时也会复制而不是移动
- perl - perl 对 return 语句的引用和取消引用
- huawei-mobile-services - HMS Push Kit,getToken() 方法在 Android 9 上不工作
- nativescript - Nativescript 6.5 iOS 挂起事件仅在应用再次激活时触发
- java - 如何从不同 PC 的另一个工作区导入 Java 类文件
- php - 导出 mysql 表和 zipArchive