gpt4 book ai didi

css - Bootstrap 4 列的 flex 对齐

转载 作者:太空宇宙 更新时间:2023-11-04 07:51:44 24 4
gpt4 key购买 nike

我完全糊涂了。我弄清楚了这一点,然后刷新了 jsfiddle,解决方案以某种方式发生了变化。我有一排两列。我无法让两列在同一行上对齐。我尝试使用 justify-content-around 但它不起作用。帮助将不胜感激。

<div class="container-fluid">
<div class="d-flex flex-row justify-content-around my-flex-container">
<div class="d-flex flex-column my-flex-container-column">
<div class="flex-row my-flex-container">Row 1</div>
<div class="flex-row my-flex-container">Row 2</div>
<div class="flex-row my-flex-container">Row 3</div>
<div class="flex-row my-flex-container">Row 4</div>
</div>
<div class="d-flex flex-column my-flex-container-column">
<div class="d-flex flex-row my-flex-container">
<div class="flex-column my-flex-container-column">
<div class="flex-row my-flex-container">Row 1
</div>
<div class="flex-row my-flex-container">Row 2
</div>
</div>
</div>
<div class="d-flex flex-row flex-1 my-flex-container">
<div class="my-auto">ROW 3</div>
</div>

</div>
</div>
</div>

jsfiddle here

最佳答案

您需要将您的 Bootstrap 版本从 Alpha 更新到 Beta 版本,您可以得到它 here .

  .my-flex-container {
border: 2px solid green;
}
.my-flex-container-column {
border: 2px solid green;
}
.flex-1{
flex: 1;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">
<div class="d-flex flex-row justify-content-around my-flex-container">
<div class="d-flex flex-column my-flex-container-column">
<div class="flex-row my-flex-container">Row 1</div>
<div class="flex-row my-flex-container">Row 2</div>
<div class="flex-row my-flex-container">Row 3</div>
<div class="flex-row my-flex-container">Row 4</div>
</div>
<div class="d-flex flex-column my-flex-container-column">
<div class="d-flex flex-row my-flex-container">
<div class="flex-column my-flex-container-column">
<div class="flex-row my-flex-container">Row 1
</div>
<div class="flex-row my-flex-container">Row 2
</div>
</div>
</div>
<div class="d-flex flex-row flex-1 my-flex-container">
<div class="my-auto">ROW 3</div>
</div>

</div>
</div>
</div>

关于css - Bootstrap 4 列的 flex 对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47708029/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com