Making a Pinterest-like grid with Bootstrap: the boxes are not displayed right below each other(使用 Bootstrap 制作类似 Pinterest 的网格:框不会显示在彼此的正下方)
问题描述
HTML 方案如下:
<div class="items">
<div class="item">...</div>
<div class="item">...</div>
<div class="item">...</div>
...
</div>
.item
CSS 样式:
float: left;
结果:
但是白框并没有一个接一个地对齐——问题可能出在哪里?我也试过用 display: inline-block;
代替 float: left;
,但结果基本一样.
But the white boxes are not aligned right one after another one -- where could be the issue? I;ve tried also using display: inline-block;
instead of float: left;
, but the result was basically the same.
谢谢
推荐答案
你可以像这样使用 CSS 3 column-width
和 column-gap
..
You can use CSS 3 column-width
and column-gap
like this..
这篇关于使用 Bootstrap 制作类似 Pinterest 的网格:框不会显示在彼此的正下方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 Bootstrap 制作类似 Pinterest 的网格:框不会显示在彼此的正下方


基础教程推荐
- 在 contenteditable 中精确拖放 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01