html - Div 的堆栈相互叠加
问题描述
第二个 div 堆叠在第一个 div 之上,第一个 div 不可见我如何将它定位在第一个 div 下方
.shop {
width: 100%;
height: 1000px;
background-color: #ffffff;
position: relative;
justify-content: center;
display: flex;
}
.bell {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
<div class="shop"></div>
<div class="bell">
<img src="bell.png" alt="">
</div>
解决方案
这是你想要做的吗?:)
.shop {
width: 100%;
height: 1000px;
background-color: #000;
justify-content: center;
display: flex;
}
.bell {
background-color: red;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
img{
width : 30%;
}
<div class="shop"></div>
<div class="bell">
<img src="https://images.pexels.com/photos/1289845/pexels-photo-1289845.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500" alt="">
</div>
推荐阅读
- php - 如何显示随机目录中的随机图像
- java - Spring JPA 数据存储库的行为不像它应该的那样
- java - 如何解决docker容器中asciidoctor的jruby问题
- assembly - 假设 x86 调用约定,绘制堆栈帧并确定本地人的地址
- html - 调整
(Ng-Zorro) 宽度 - imagemagick - 相对于错误(右上角)点的图像旋转
- c - 如何在 C 中将 EOF 与 fgets() 一起使用
- java - java到mysql。我需要从字符串参数转换为时间戳
- javascript - 如何从具有方括号 [] 内的值的字符串中获取值?
- android - Xamarin.Android 应用程序上的模糊 Dotfuscator 错误