gpt4 book ai didi

html - 将 6 个图像彼此相邻对齐响应式 Bootstrap

转载 作者:行者123 更新时间:2023-11-28 10:24:22 25 4
gpt4 key购买 nike

我试图用 bootstrap 将 6 张图像排成一行,但我只得到 4 张图像,它们之间有很大的空间。我不是 CSS 专家。

这是我的 HTML 代码

<html>
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<style>
.container-best
{
width:70%;
text-align:center;
margin: auto;
}
.best-rate
{
background-color: #ffd564;
text-align: center;
font: 20px 'aleobold', sans-serif;
color: #4c4145;
text-transform: uppercase;
padding-bottom: 25px;
padding-top: 26px;
position: relative;
}
</style>
</head>
<body>
<div class="container">
<div class="container-best">
<div class="best-rate">
☆☆☆☆☆☆☆Today Best Choice☆☆☆☆☆☆☆
</div>
</div>
<br />
<div class="row">
<div class="col-md-2 col-md-offset-1">
<img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/mercenaries.jpg">
</div>
<div class="col-md-2 col-md-offset-1" >
<img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/Narco-Valley.jpg">
</div>
<div class="col-md-2 col-md-offset-1" >
<img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/Vikingdom.jpg" >
</div>
<div class="col-md-2 col-md-offset-1" >
<img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/Red-Dirt-Rising.jpg" >
</div>
<div class="col-md-2 col-md-offset-1" >
<img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/At-All-Cost.jpg" >
</div>
<div class="col-md-2 col-md-offset-1" >
<img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/mercenaries.jpg" >
</div>
</div>
<div>
</body>
</html>

我试了很多次都失败了,我不知道是什么问题,请帮忙。

提前致谢

最佳答案

首先,添加CSS类,

.img-responsive{
width: 100%;
}

删除 div 标签中的“col-md-offset-1”。并将图像添加到 .

<div class="container"> 
<div class="row">
<div class="col-md-2">
<img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/mercenaries.jpg">
</div>
<div class="col-md-2" >
<img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/Narco-Valley.jpg">
</div>
<div class="col-md-2" >
<img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/Vikingdom.jpg" >
</div>
<div class="col-md-2" >
<img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/Red-Dirt-Rising.jpg" >
</div>
<div class="col-md-2" >
<img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/At-All-Cost.jpg" >
</div>
<div class="col-md-2" >
<img class="img-responsive" src="https://www.linkedfilm.com/upload/photos/2019/01/mercenaries.jpg" >
</div>
</div>
</div>

关于html - 将 6 个图像彼此相邻对齐响应式 Bootstrap ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57452025/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com