简体   繁体   English

在列中引导空白空间

[英]Bootstrap empty space in a column

Please see the attachment for more detailed comprehension 请参阅附件以获取更详细的理解

I'm using Bootstrap in my current project. 我在当前项目中使用Bootstrap。 As you can see from the picture, there's a blank space that comes in a first column right after the content. 从图片中可以看到,内容后面的第一列中有一个空白。 Though if I just use columns without any styling, clearly the desired space isn't going to take place. 虽然如果我只使用没有任何样式的列,则显然不会发生所需的空间。 What is the best solution for this problem? 解决此问题的最佳方法是什么? I was thinking of wrapping the content in a div with min-height rule but obviously it's a clumsy option. 我当时正在考虑用最小高度规则将内容包装在div中,但是显然这是一个笨拙的选择。

Thank you. 谢谢。

That is your grid gutter. 那就是你的网格排水沟。 You can change the width of it with a custom build or by using the source code and changing the scss variable $grid-gutter-width . 您可以使用自定义版本或使用源代码并更改scss变量$grid-gutter-width gutter $grid-gutter-width更改其$grid-gutter-width

As said, the problem is with the gutters. 如前所述,问题出在排水沟上。 I use this classes to avoid gutter when I don't want them: 当我不想使用这些类时,可以避免发生装订线:

css: CSS:

.row.no-gutters {
    margin-right: 0;
    margin-left: 0;
}
.row.no-gutters > [class^='col-'], 
.row.no-gutters > [class*=' col-'] {
    padding-right: 0;
    padding-left: 0;
}

// I use those for removing side padding when necessary for an specific col
[class^='col-'].no-pad, [class*=' col-'].no-pad {
    padding: 0px;
}
[class^='col-'].no-left-pad, [class*=' col-'].no-left-pad {
    padding-left: 0px;
}
[class^='col-'].no-right-pad, [class*=' col-'].no-right-pad {
    padding-right: 0px;
}

sass: ass

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

    > [class^='col-'], > [class*=' col-'] {
        padding-right: 0;
        padding-left: 0;
    }
}
// I use those for removing side padding when necessary for an specific col
[class^='col-'].no-pad, [class*=' col-'].no-pad {
    padding: 0px;
}
[class^='col-'].no-left-pad, [class*=' col-'].no-left-pad {
    padding-left: 0px;
}
[class^='col-'].no-right-pad, [class*=' col-'].no-right-pad {
    padding-right: 0px;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM