首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Bootstrap-4组织DIV内容

使用Bootstrap-4组织DIV内容
EN

Stack Overflow用户
提问于 2020-06-21 10:07:11
回答 2查看 155关注 0票数 0

我找不到使用Bootstrap对齐/组织div内容的解决方案。我不太明白它是怎么工作的

aling items-* text-* aling self-* justify-items- * justify-self- *

我正在尝试用以下方式组织我的网站:

但我无法对齐内容,使其完全连接到左边缘或右边缘,或者使内容处于左侧,无论是img、text还是位于其中心的另一个div。我想避免使用填充或页边距,因为我试图使一个响应性的内容,然后他们可能会给我其他问题。非常感谢你的帮助,问候。

EN

回答 2

Stack Overflow用户

发布于 2020-06-21 12:06:42

这可能会帮助您开始:

使用fiddle解决方案

代码语言:javascript
复制
.MainDiv {
  border: 1px solid red;
  height: 210px;
  width: 100%;
  display: flex;
  margin: 5px;
}

.First {
  border: 1px solid blue;
  width: 33%;
  height: 200px;
  display: flex;
  justify-content: flex-start;
  margin: 5px;
}

.FirstSubDiv {
  border: 1px solid green;
  height: 200px;
  width: 50%;
}

.Second {
  border: 1px solid blue;
  width: 33%;
  height: 200px;
  display: flex;
  justify-content: center;
  margin: 5px;
}

.SecondSubDiv {
  border: 1px solid green;
  height: 200px;
  width: 50%;
  text-align: center;
}

.Third {
  border: 1px solid blue;
  width: 33%;
  height: 200px;
  display: flex;
  justify-content: flex-end;
  margin: 5px;
}

.ThirdSubDiv {
  border: 1px solid green;
  height: 200px;
  width: 50%;
  text-align: right;
}
代码语言:javascript
复制
<div class="MainDiv">
  <div class="First">
    <div class="FirstSubDiv">
      contents are in left;
    </div>
  </div>

  <div class="Second">
    <div class="SecondSubDiv">
      contents are in center;
    </div>
  </div>

  <div class="Third">
    <div class="ThirdSubDiv">
      contents are in right;
    </div>
  </div>

</div>

票数 0
EN

Stack Overflow用户

发布于 2020-06-21 10:14:14

这里提供了您需要的所有信息:https://getbootstrap.com/docs/4.5/layout/grid/

开始时,您只需复制和粘贴引导程序html并对其进行调整即可。逐渐地,你会得到它的要点(在测试和试用之后),并且你将能够自己工作。

编辑 https://getbootstrap.com/docs/4.0/utilities/flex/

查看附加的图像。如果这就是您要做的事情,请访问此link

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

https://stackoverflow.com/questions/62493693

复制
相关文章

相似问题

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