html - Bootstrap Containers Overlapping With Each Other
问题描述
I am using multiple Bootstrap 4 grids on my website. I created the following 2 grids, however, the containers overlap with each other, ie. the text "Hello" appears on top of the images. I could not figure out how to separate the containers/rows from each other. I would appreciate any information!
<div class="container-fluid">
<div class="row">
<div class="col-sm-4 imgdiv">
<div class="row">
<img src="https://cdn.pixabay.com/photo/2016/12/13/05/15/puppy-1903313_1280.jpg" id="narrow">
<img src="https://cdn.pixabay.com/photo/2016/12/13/05/15/puppy-1903313_1280.jpg" id="narrow">
</div>
</div>
<div class="col-sm-8 imgdiv">
<img src="https://cdn.pixabay.com/photo/2016/12/13/05/15/puppy-1903313_1280.jpg" id="wide">
</div>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-sm text">Hello</div>
<div class="col-sm text">Hello</div>
</div>
<div class="row">
<div class="col-sm text">Hello</div>
<div class="col-sm text">Hello</div>
</div>
</div>
解决方案
重叠网格单元给您的印象是图像没有响应。尝试添加 width: 100%;
您的图像
https://codepen.io/iondrimba/pen/GbaNBb?editors=0100
在您的 css 文件中:
.imgdiv img {
width: 100%;
}
推荐阅读
- javascript - Slider Show 无法正常工作,似乎无法找到问题所在
- google-apps-script - 如何在 Google 工作表中自动运行脚本
- python - 如何让布局显示在底部
- python - 解析 XML 后,即使在注册命名空间后也缺少两个命名空间
- python - __init__ 中的链接函数
- c# - 如何从 asp.net core 中的外部 Json 文件访问数据?
- sql - 基于先进后出生成查询的 Oracle 查询获取员工进出时间
- url - 如何过滤多级扩展的Odata Query?
- reactjs - 如何将我的自定义主题从带有 material-ui 的反应项目传递给一个相同的主题,但只有可重用的组件通过汇总转译?
- c++ - GetKeyboardLayout() 在 ENG US 和 ENG INT 之间切换时不会改变