Twitter bootstrap 从引导4中的网格列中删除填充槽

Twitter bootstrap 从引导4中的网格列中删除填充槽,twitter-bootstrap,bootstrap-4,Twitter Bootstrap,Bootstrap 4,如何在Bootstrap4中创建无槽网格 是否有用于移除排水沟的官方API或手动API?Bootstrap4: 附带。没有现成的排水沟。 资料来源: Bootstrap3: 需要自定义CSS 样式表: .row.no-gutters { margin-right: 0; margin-left: 0; & > [class^="col-"], & > [class*=" col-"] { padding-right: 0; paddi

如何在Bootstrap4中创建无槽网格


是否有用于移除排水沟的官方API或手动API?

Bootstrap4: 附带
。没有现成的排水沟。
资料来源:

Bootstrap3:

需要自定义CSS

样式表:

.row.no-gutters {
  margin-right: 0;
  margin-left: 0;

  & > [class^="col-"],
  & > [class*=" col-"] {
    padding-right: 0;
    padding-left: 0;
  }
}
然后使用:

<div class="row no-gutters">
  <div class="col-xs-4">...</div>
  <div class="col-xs-4">...</div>
  <div class="col-xs-4">...</div>
</div>

...
...
...
它将:

  • 从行中删除边距
  • 删除行正下方所有列的填充

您可以使用此css代码在引导中获得无齿槽网格

.no-gutter.row,
.no-gutter.container,
.no-gutter.container-fluid{
  margin-left: 0;
  margin-right: 0;
}

.no-gutter>[class^="col-"]{
  padding-left: 0;
  padding-right: 0;
}

您可以使用mixin
make col ready
并将边沟宽度设置为零:

@包括使列就绪(0)

需要边到边的设计吗?放下父容器
.container
.container fluid

但是,如果您需要从
.row
和立即子列中删除填充,则必须将类
添加到您自己的CSS文件中。
没有水槽,因为上面@Brian的代码不是“开箱即用”的,在这里查看有关最终Bootstrap 4发行版的官方详细信息:

您应该使用自定义元素间距,这是一种更方便的方法