Bootstrap 4 如何在Bootstrap 4列中垂直对齐
我有这样的结构:Bootstrap 4 如何在Bootstrap 4列中垂直对齐,bootstrap-4,Bootstrap 4,我有这样的结构: <div class=”row”> <div class=”col”> <div class=”float-to-top”></div> <div class=”float-to-bottom></div> </div> <div class=”col”> <div class=”float-to-top
<div class=”row”>
<div class=”col”>
<div class=”float-to-top”></div>
<div class=”float-to-bottom></div>
</div>
<div class=”col”>
<div class=”float-to-top”></div>
<div class=”float-to-bottom></div>
</div>
</div>
任务是将同一类的div彼此对齐。作为引导4,两列的高度相同,免费;我可以把顶部和底部对齐。但如何在垂直方向上“证明”呢
哦,不允许使用媒体查询;只有引导功能
谢谢您的帮助。听起来您想交换行和列。这样,您的两个
.col
类彼此相邻,并且您的.float to top
位于顶部(底部为.float to bottom
)
如果是这种情况,请在.col
上查找以下内容:
使用flexboxdisplay:flex
交换布局flex-direction:column
之间留出空格,将元素隔开(顶部和底部)justify content:在
- a
在元素之间添加空间高度
用于水平居中对齐项目:居中
.col{
显示器:flex;
弯曲方向:立柱;
证明内容:之间的空间;
高度:180像素;
对齐项目:居中;
}
第一名
底部1
前2名
底部2
你能澄清这个问题并给出一个简单的例子来说明这个问题吗?你说的“证明”是什么意思?你的意思是垂直居中吗?你知道,当你把文本水平居中时,文本会根据需要被额外的空格包围。当你对同一个文本进行对正时,额外的空白在文本内部,在单词之间;字符串外没有空格。抱歉,我没有意识到我不应该按Enter键。这里的想法相同:我需要每个列中的第一个div从列的顶部开始;位于柱底部的底部div端;如果顶部div的高度不同,则空格应位于顶部div和底部div之间。