gpt4 book ai didi

html - 使用 bootstrap col 时图像左右两侧的空白

转载 作者:太空宇宙 更新时间:2023-11-04 10:07:18 25 4
gpt4 key购买 nike

我有一排有 3 张图片。
左图左侧有空白区域。
右图右侧有空白。

我该如何解决这个问题,这样我的左右两侧就没有空格了?

请参阅下面的代码:

图像中的背景为橙色,因此更清晰可见。

HTML:

<div class="container section">
<div class="row">
<div class="col-md-offset-1 col-md-10 featured">

<div class="col-md-4 img-featured-1">
<%= image_tag("featured-1.jpeg", class: "img-responsive") %>
</div>
<div class="col-md-4 img-featured-2">
<%= image_tag("featured-2.jpeg", class: "img-responsive") %>
</div>
<div class="col-md-4 img-featured-3">
<%= image_tag("featured-3.jpeg", class: "img-responsive") %>
</div>

</div>
</div>
</div>

CSS:

.featured {
background-color: orange;
}
.img-featured-1 {
width: 33.33333%;
float: left;
}
.img-featured-2 {
width: 33.33333%;
}
.img-featured-3 {
width: 33.33333%;
float: right;
}

See the image

最佳答案

试试这个:

.featured {
background-color: orange;
}

.nopadding {
padding:15px 0px;}

+

<div class="container section">
<div class="row">
<div class="col-md-offset-1 col-md-10 nopadding">

<div class="col-md-4 img-featured-1">
<img src="https://placeholdit.imgix.net/~text?txtsize=33&txt=350%C3%97150&w=350&h=150">
</div>
<div class="col-md-4 img-featured-2">
<img src="https://placeholdit.imgix.net/~text?txtsize=33&txt=350%C3%97150&w=350&h=150">
</div>
<div class="col-md-4 img-featured-3">
<img src="https://placeholdit.imgix.net/~text?txtsize=33&txt=350%C3%97150&w=350&h=150">
</div>

</div>
</div>
</div>

关于html - 使用 bootstrap col 时图像左右两侧的空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37900152/

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