如何删除引导网格列的默认填充

我有一个网格系统,我在网格列中添加了一个表格。但是该表格没有覆盖该列的整个宽度。它在左侧和右侧都显示了空间。是否是因为网格列的默认填充而发生这种情况?



慕斯709654
浏览 103回答 3
3回答

天涯尽头无女友

请首先提供您的代码。你可以no-gutters选择:&nbsp;Columns have horizontal padding to create the gutters between individual columns, however, you can remove the margin from rows and padding from columns with .no-gutters on the .row.https://getbootstrap.com/docs/4.0/layout/grid/<div class="row no-gutters">&nbsp; <div class="col-md-2">&nbsp; &nbsp; // stuff here for this column&nbsp; </div>&nbsp; <div class="col-md-10">&nbsp; &nbsp; // stuff here for columns&nbsp; </div></div>或者:您必须查看哪个属性(可能是 col)添加了空格(边距或填充)我在之前的项目中添加了这个以减少所有列的空间.col, .col-1, .col-10, .col-11, .col-12, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-auto, .col-lg, .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-auto, .col-md, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-auto, .col-sm, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-auto, .col-xl, .col-xl-1, .col-xl-10, .col-xl-11, .col-xl-12, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9, .col-xl-auto&nbsp;{ padding: 3px !important; }&nbsp;根据您的需要进行调整

茅侃侃

如果您scss使用Bootstrap V4 ,您可以width使用更改装订线variable。$grid-gutter-width: 2rem !default;如果你想改变column某些部分的填充。您应该添加自定义类并这样做。超文本标记语言<div class="row custom-row">&nbsp; &nbsp; <div class="col-12 col-md-4"></div>&nbsp; &nbsp; <div class="col-12 col-md-4"></div>&nbsp; &nbsp; <div class="col-12 col-md-4"></div></div>CSS.custom-row{&nbsp; &nbsp; margin-left: -10px;&nbsp; &nbsp; margin-right: -10px;}.custom-row .col-12{&nbsp; &nbsp; padding-left: 10px;&nbsp; &nbsp; padding-right: 10px;}/* Wild card with class */.custom-row [class~=col]{&nbsp; &nbsp; padding-left: 10px;&nbsp; &nbsp; padding-right: 10px;}.custom-row [class*='col-']{&nbsp; &nbsp; padding-left: 10px;&nbsp; &nbsp; padding-right: 10px;}/* Wild card with global */[class*='col-']{&nbsp; &nbsp; padding-left: 10px;&nbsp; &nbsp; padding-right: 10px;}

慕婉清6462132

您只需将 .g-0 添加到列即可删除列之间的默认装订线。<div class="col g-0">&nbsp; <h1>Heading</h1>&nbsp; <p>Lorem ipsum</p></div>https://getbootstrap.com/docs/5.0/layout/gutters/#no-gutters
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Html5