gpt4 book ai didi

html - 3 列 DIV 之间的间距

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

这是我想要的例子

enter image description here

这些图像是从 MySQL 中的 while 循环加载的,并且希望它们之间的间距能够使左列和右列接触每一侧,中间居中。喜欢图片:D

我拥有的 CSS:

#realisation .box{
float:left;
width:286px;
background:#fff;
padding:10px;
margin-right:20px;
-moz-box-shadow: 1px 2px 2px #ccc;
-webkit-box-shadow: 1px 2px 2px #ccc;
box-shadow: 1px 2px 2px #ccc;
}

#realisation .box:last-child{
margin-right:0px;
}

还有循环

<div class="box">
<div><img src="imgs/beta/imgpasrap.jpg" width="286" height="176"/></div>
<p>Text here</p>
</div>

前 3 个盒子运行良好,但不仅如此,显示也很困惑。我怎样才能像上图那样实现?

最佳答案

在包含所有这些图像的框上设置宽度。 (引用:http://jsfiddle.net/52TUV/)
(注意:图像的样式只是为了保持它们的大小——不需要添加它们)

<div id="outer">
<!-- image HTML stuff goes here -->
</div>
#outer{
width: 1000px;
}

关于html - 3 列 DIV 之间的间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6753059/

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