【问题标题】:Bootstrap 4 Alpha 6 Column taking up full widthBootstrap 4 Alpha 6 Column 占满全宽
【发布时间】:2017-01-08 01:24:19
【问题描述】:

我刚刚将我的一个电子应用程序升级到 Bootstrap 的新 Alpha 6 for Bootstrap 4。他们对网格系统和 flexbox 进行了大量调整,这反过来又给我的电子应用程序带来了一些不稳定的错误。 目前我有一个侧边栏和一个主要区域。

尽管我将它定义为 .col-4 .col-xl-3,但侧边栏占据了整个屏幕宽度,

它把所有东西都推到它下面的右边。如何防止这种行为发生?

编辑:更多代码,之前的问题已修复,但在@haxxtron 的回答下,左侧现在没有填充。

    <div class ="row">
    <div class = "room-container pl-3 col-4 col-xl-3">
    <div class="room mt-2 col-offset-1">
        <h4 class = "text-muted">Room: </h4>
        <h5 class = 'display room-name'></h5>
        <h4 class = "text-muted">Chat Count: </h4>
        <h5 class = 'display chat-count'></h5>
        <h4 class = "text-muted">Username: </h4>
        <h5 class = 'display username'></h5>
    </div>
    <p class = "lead footer" id="me"> { } with <img class = "heart" src="../js/img/heart.svg"> by <a href="http://siwiec.us">Adam Siwiec</a></h3>
</div>

<div  class="right-status-container col-8 col-xl-9">
    <div id="avatar"></div>
    <div id="status-container">
        <h4 class = "pl-1 pt-1">Status: </h4>
        <div class = "pl-1" id = "status">
        </div>
    </div>
</div>
</div>

【问题讨论】:

标签: html css twitter-bootstrap


【解决方案1】:

.row's,补偿应用于列的装订线。来自Docs

行是列的水平组,可确保您的列正确排列。我们在.row 上使用负边距方法来确保您的所有内容都在左侧正确对齐。

尝试以下方法:

JSFIDDLE

HTML

<div class="row">
    <div class="col-4 col-xl-3 no-gutter">
    LEFT
    </div>
    <div class="col-8 col-xl-9">
     RIGHT
    </div>
</div>

【讨论】:

  • 这确实有效,但现在对于 .col-4,它的左侧没有填充。那是怎么回事?
  • 我通过添加另一个带有 .container-fluid 类的 div 来包装所有内容来解决这个问题!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-05-22
  • 2017-07-23
  • 1970-01-01
  • 1970-01-01
  • 2018-10-05
相关资源
最近更新 更多