html - 删除卡片组中卡片之间的多余空格

标签 html css twitter-bootstrap jinja2

我正在使用 Flask 中的 Jinja2 将列表呈现到 html 页面。 我想使用 Jinja2 循环使用该列表中的一些数据创建卡片组。

我当前的 HTML 代码:

<div class="container-fluid">
    <div class="row">
       <div class="card-deck">
            {% for l in list %}
            <div class="col-sm-4">
                <div class="card">
                     <div class="card-body">
                            {{ l[0] }}
                            {{ l[4] }}
                     </div>
                </div>
            </div>
         {% endfor %}
       </div>
   </div>
</div>

结果:

enter image description here

我不想要那些额外的红色空格:

enter image description here

我怎样才能删除它们?

谢谢

最佳答案

通过使用这个例子解决: https://www.bootply.com/118335

从这个问题: Is it possible to create a pinterest-like layout with Bootstrap only?

更新后的代码:

HTML:

<div class="container-fluid">
     <div class="row" id="row_posts">
        {% for l in list %}
        <div class="col-sm-4" id="col_posts">
            <div class="card" id="card_posts">
                 <div class="card-body">
                        {{ l[0] }}
                        {{ l[4] }}
                 </div>
            </div>
        </div>
     {% endfor %}
    </div>
</div>

CSS:

*, *:before, *:after {box-sizing:  border-box !important;}

#row_posts {
-moz-column-width: 22em;
-webkit-column-width: 22em;
-moz-column-gap: 1em;
-webkit-column-gap:1em; 
 }

#col_posts {
display: inline-block;
padding:  .25rem;
width:  100%; 
}

#card_posts {
position:relative;
display: block;
}

关于html - 删除卡片组中卡片之间的多余空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50201895/

相关文章:

Javascript 窗口对象

javascript - 文本区域验证不起作用 Javascript

html - 将一个 <span> 对齐到 <div> 元素的右边距

css - 尝试将 CSS 引入数据库时​​,MySQL INSERT 语句不起作用

css - 组合 CSS 类以定位特定页面

javascript - 使用折叠菜单

html - 在我的页面右侧添加一个额外的空间

javascript - 如何仅在按下取消按钮时关闭模态弹出窗口?

twitter-bootstrap - Bootstrap 3 弹出框和工具提示在同一元素上

html - 如何将顶部的右 block 与移动设备上的 Bootstrap 对齐?