首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Boostrap 4 Row as -流体具有与容器相同的填充

问Boostrap 4 Row as -流体具有与容器相同的填充
EN

Stack Overflow用户
提问于 2017-06-20 23:43:03
回答 1查看 664关注 0票数 2

我正在尝试使用bootstrap 4创建一个网站,但遇到了一个问题。

​

​

由于页眉和页脚的背景应该扩展到页面的边缘,因此页面是一种较为流畅的外观。

在页眉和页脚中,一个容器用于菜单和页脚内容,因此所有内容都处于中心位置。

页眉和页脚之间的内容应该以类似的方式工作(背景延伸到边缘),但我使用的是列,以便在一侧可能是蓝色,而在另一侧可能是白色。我希望这些行的内容与页眉页脚一致(页眉中菜单的左边缘与文本的位置相同)

我不知道从哪里开始,我试着在容器顶部叠加一个容器--流体,但行数不匹配。

到目前为止,我已经创建了这个代码笔。

css:

代码语言:javascript
复制
    .rowoverlay {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    bottom: 0;
    right: 0;
    height: 100%;
}

HTML

代码语言:javascript
复制
<div class="container-fluid homepage-text-plugin">

    <div class="row rowoverlay">
        <div class="col-md-12 col-lg-5" style="background-color: green;"></div>
        <div class="col-md-12 col-lg-7" style="background-color: red;">

      </div>

    </div>

    <div class="container ">

        <div class="row">
            <div class="col-md-12 col-lg-4 " style="background-color: blue;">
                A text block
            </div>
            <div class="col-md-12 col-lg-7" style="background-color: yellow;">
                More text<p>
            </div>

        </div>
    </div>

</div>

​

​

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-06-21 00:33:26

你可以用CSS flexbox来设置样式。也许你应该看一看。这是一个代码片段的布局示例,来自您绘制的糟糕的图像lol。

​

代码语言:javascript
复制
.row-example {
  display: flex;
  background: red;
  width: 100%;
}

.row-1-left {
  width: 300px;
  height: 100px;
  background: blue;
}

.row-1-center {
  display: flex;
  width: 100%;
  height: 100px;
  background: green;
  justify-content: center;
}

.row-1-right {
  width: 300px;
  height: 100px;
  background: yellow;
}

.row-2-left {
  width: 1000px;
  height: 200px;
  background: yellow;
}

.row-2-right {
  justify-content: center;
  width: 100%;
  height: 200px;
  background: orange;
}

.row-3-left {
  width: 1400px;
  height: 200px;
  background: red;
}

.row-3-right {
  justify-content: center;
  width: 100%;
  height: 200px;
  background: blue;
}

.row-4-left {
  width: 300px;
  height: 50px;
  background: blue;
}

.row-4-center {
  width: 100%;
  height: 50px;
  background: green;
  justify-content: center;
}

.row-4-right {
  width: 300px;
  height: 50px;
  background: yellow;
}
代码语言:javascript
复制
<div class="container-fluid homepage-text-plugin">
  <div class="row-example">
    <div class="row-1-left"></div>

    <div class="row-1-center">
      <p>Header container</p>
    </div>

    <div class="row-1-right"></div>
  </div>

  <div class="row-example">
    <div class="row-2-left"></div>

    <div class="row-2-right"></div>
  </div>

  <div class="row-example">
    <div class="row-3-left"></div>

    <div class="row-3-right"></div>
  </div>

  <div class="row-example">
    <div class="row-4-left"></div>

    <div class="row-4-center"></div>

    <div class="row-4-right"></div>
  </div>
</div>

​

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44657534

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档