我需要在下面的图像中给出的视图
2
.tile {
/* TODO: MODULE_CARDS */
/* 1. Fill in the required properties. */
box-sizing: border-box;
padding: 20px;
margin-bottom: 10px;
}
.tile img {
/* TODO: MODULE_CARDS */
/* 1. Fill in the required properties. */
border-radius: 25px;
max-width: 100%;
height: 50vh;
}
<div class="container">
<!-- TODO: MODULE_LAYOUT -->
<!-- 1. Create the grid like layout as required. -->
<div class = "row">
<div class = "tile d-flex justify-content-center">
<img src = "assets/bengaluru.jpg" alt = "bengaluru" class ="tile img" >
</div>
<div class = "tile d-flex justify-content-center">
<img src = "assets/kolkata.jpg" alt = "kolkata" class ="tile img" >
</div>
<div class = "tile d-flex justify-content-center">
<img src = "assets/goa.jpg" alt = "goa" class ="tile img" >
</div>
<div class = "tile d-flex justify-content-center">
<img src = "assets/mumbai.jpg" alt = "mumbai" class ="tile img" >
</div>
</div>
<div class = "row">
<div class = "tile d-flex justify-content-center">
<img src = "assets/singapore.jpg" alt = "singapore" class ="tile img" >
</div>
<div class = "tile d-flex justify-content-center">
<img src = "assets/dubai.jpg" alt = "dubai" class ="tile img" >
</div>
<div class = "tile d-flex justify-content-center">
<img src = "assets/malaysia.jpg" alt = "malaysia" class ="tile img" >
</div>
<div class = "tile d-flex justify-content-center">
<img src = "assets/paris.jpg" alt = "paris" class ="tile img" >
</div>
</div>
我需要一个帮助,如何修复每一行的flexbox项目的图像数量。由于网页应该是响应式的,这意味着根据屏幕尺寸调整每行的图像数量
2条答案
按热度按时间col17t5w1#
您可以使用flexbox进行布局。Flex wrap和width将处理每行的项目数量。你不需要行 Package 器。根据需要调整宽度和高度。我添加了一些占位符图像。
您可以使用相对 Package 器(可以是项目本身)和绝对子项(标题)来显示顶部的文本,也可以使用z索引来分层。
ttp71kqs2#
有一些bootstrap
col
类可以做到这一点。你也可以使用响应式。Bootstrap为图像提供了一个名为img-thumbnail
的类。我已经用CSS覆盖了一点,并保留了原始的CSS。这里是一个工作示例的图像:
看看下面的片段:
**
Note:
**最大化您的屏幕以更好地理解。如果你想了解更多关于bootstrap的网格系统,check this link
out。