代码之家  ›  专栏  ›  技术社区  ›  Robert Andrews

为什么我不能在Bootstrap 4中合并对正资源中心和对正内容?

  •  0
  • Robert Andrews  · 技术社区  · 6 年前

    我有一个 自举4大气压计 包含列,根据断点设置不同的网格宽度。

    这很好,但我还想将列设置为 左边 ,位于包装它的行内,具体取决于断点: 居中 md 包含全部费用 lg 向上。

    justify-content-center row 正确地将列置于中间。。。

    enter image description here

    justify-content-lg-left 左边 巨无霸 lg

    我还试着只把中心放在 justify-content-md-center lg 尺寸仍然不会向左移动。

    justify 就像我为你做的一样 col-*

    代码

    <div class="jumbotron jumbotron-fluid-flex text-white mb-0 rounded-0">
      <div class="container-fluid py-5">
        <div class="row d-flex justify-content-center justify-content-lg-left">
          <div class="col-sm-12 text-center col-md-9 text-lg-left col-lg-8 pl-lg-3 align-self-center bg-warning">
            <h1 class="text-dark">My column content</h1>
          </div>
        </div>
      </div>
    </div>
    
    2 回复  |  直到 6 年前
        1
  •  1
  •   Shidersz    6 年前

    没有 justify-content-left justify-content-start . 阅读 the docs 并检查下一个示例:

    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
    
    <div class="jumbotron jumbotron-fluid text-white mb-0 rounded-0">
      <div class="container-fluid py-5">
        <div class="row justify-content-center justify-content-lg-start">
          <div class="col-sm-12 text-center col-md-9 text-lg-left col-lg-8 pl-lg-3 align-self-center bg-warning">
            <h1 class="text-dark">My column content</h1>
          </div>
        </div>
      </div>
    </div>

    (1) jumbotron-fluid-flex 引导上不存在。也许你两者都想要: jumbotron-fluid d-flex

    (2) 等级 d-flex row

        2
  •  1
  •   IvanS95    6 年前

    试着打开这个

    在引导中证明内容正确的类有:

    • 调整内容开始
    • 证明内容结束
    • 调整资源中心

    <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
    <div class="jumbotron jumbotron-fluid-flex   text-white mb-0 rounded-0 " >
        <div class="container-fluid py-5">
          <div class="row d-flex justify-content-center justify-content-lg-start">
            <div class="col-sm-12 text-center   col-md-9  text-lg-left   col-lg-8 pl-lg-3  align-self-center bg-warning">
              <h1 class="text-dark">My column content</h1>
            </div>
          </div>
        </div>
    </div>