html - Flexbox 列垂直间距 - 之间不起作用
问题描述
如何在垂直内容之间留出空格?在示例中,在第三列中,我希望能够在不指定高度的情况下证明红色和黑色 div 之间的内容(目前在这里举个例子)。没有它我不能这样做吗,因为我们已经从中间 col 有了最大高度?
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="d-flex align-items-center">
<div class="col-auto">
<div>asdqwd</div>
</div>
<div class="col d-flex flex-column text-center">
<div>rgergre</div>
<div>vs</div>
<div>rger ergerg</div>
</div>
<div class="col-auto d-flex flex-column justify-content-between" style="height:72px">
<div style="height:20px;width:20px;background:red">ewf</div>
<div style="height:20px;width:20px;background:black">qwd</div>
</div>
</div>
解决方案
Align-items center 将其丢弃在.d-flex align-items-center
两种选择:
1)添加align-self: stretch
到第三个弯曲块。
2)删除align-items: center
并添加align-self: center
到第一个块。
推荐阅读
- python - 我们可以从字符串中提取数字并将它们相乘吗
- vue.js - 设置新的 Vuetfy 2 Beta 7 - 观察者“isDark”的吸气剂错误
- swift - 使用 url-schema 打开应用程序,但如果 url 有一些对象,请不要打开应用程序,只需在浏览器中打开
- javascript - 在 javascript 中终止挂起的 Promise
- video - stereo_mode=left_right 元数据标签消失
- java - 返回单声道
使用反应式 MongoDB 模板 - kubernetes - 为什么 kubernetes HPA 没有缩小 pod?
- android - 是否可以从 Android 应用程序执行 Shell 脚本
- javascript - jQuery:一旦条件语句返回错误,停止窗口高度重新计算
- types - 是否可以在 ABAP 中创建选项类型?