【问题标题】:how to remove padding from container-fluid without causing horizontal scroll bars to appear in bootstrap 4如何从容器流体中删除填充而不导致水平滚动条出现在引导程序 4 中
【发布时间】:2022-02-04 00:35:39
【问题描述】:

引导类 container-fluid 在其中的所有内容的左侧和右侧提供 15 像素的填充。当我创建另一个类以删除容器流体提供的左右填充时,我得到一个水平滚动条。我该如何解决?我希望 container-fluid 中的所有东西都覆盖整个宽度,两边都没有空间。

【问题讨论】:

标签: html css bootstrap-4


【解决方案1】:

container-fluid 不应提供填充。如果您使用 container-fluid,整个容器将达到 100% 的宽度。

您确定没有提供填充的类吗?

【讨论】:

  • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center
【解决方案2】:

您无需创建任何 CSS 即可更改 Bootstrap 填充(或边距)。在您的 HTML 中,以下内容将起作用。

您可以使用 0 到 5 之间的任何数字,其中 5 是最大的填充量。

class="p-0" will create no padding at all.
class="px-0" will create no horizontal padding.
class="py-0" will create no vertical padding.

另外。

class="pt-*" will change padding top.
class="pb-*" will change padding bottom.
class="ps-*" will change left side padding (padding-start).
class="pe-*" will change right side padding (padding-end).

* = insert number between 0 and 5

如果您想更改边距而不是填充,所有这些工作都是用 m 替换 p

【讨论】:

    猜你喜欢
    • 2014-07-09
    • 2017-02-13
    • 2018-11-03
    • 2018-06-20
    • 1970-01-01
    • 2021-07-30
    • 1970-01-01
    • 2015-09-30
    • 2021-07-15
    相关资源
    最近更新 更多