gpt4 book ai didi

html - Bootstrap 'align-content-around' 不工作

转载 作者:行者123 更新时间:2023-11-27 22:56:33 25 4
gpt4 key购买 nike

为什么 align-content: space-around 在这里不起作用?解决方法是什么?需要将第 3 列和第 4 列底部对齐。

.row {
background: #f8f9fa;
}

.col {
border: solid 1px red;
padding: 10px;
height: 200px;
}

.col-sm-6 {
border: 1px solid green;
}
<script type="text/javascript" src="//code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<link rel="stylesheet" type="text/css" href="//stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<script type="text/javascript" src="//stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">


<div class="container">
<div class="row">
<div class="col">
1 of 2
</div>
<div class="col">


<div class="row align-content-around">
<div class="col-sm-6">
1
</div>
<div class="col-sm-6">
2
</div>
<div class="col-sm-6">
3
</div>
<div class="col-sm-6">
4
</div>
</div>

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

fiddle - https://jsfiddle.net/afelixj/y9perjhf/

最佳答案

你的 rowauto 高度 - 添加 height: 100%h-100 类 -请参阅下面的演示:

.row {
background: #f8f9fa;
}

.col {
border: solid 1px red;
padding: 10px;
height: 200px;
}

.col-sm-6 {
border: 1px solid green;
}
<script type="text/javascript" src="//code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<link rel="stylesheet" type="text/css" href="//stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<script type="text/javascript" src="//stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">


<div class="container">
<div class="row">
<div class="col">
1 of 2
</div>
<div class="col">
<div class="row align-content-around h-100">
<div class="col-sm-6">
1
</div>
<div class="col-sm-6">
2
</div>
<div class="col-sm-6">
3
</div>
<div class="col-sm-6">
4
</div>
</div>
</div>
</div>
</div>

关于html - Bootstrap 'align-content-around' 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55529246/

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