css - 以百分比表示的 flex-basis 值如何工作?
问题描述
当我将百分比值赋予 flex-basis 时,该百分比是多少?父容器?我在几个超过 100% 的弹性项目上定义了弹性基础,但我的所有项目都正确显示。有人可以解释如何考虑弹性基础吗?我正在玩的 codepen 位于:https ://codepen.io/anon/pen/pXWQBN
<div class="container">
<div id="i1" class="items">item1</div>
<div id="i2" class="items">this is item2</div>
<div id="i3" class="items">this is third longest text</div>
<div id="i4" class="items">this is longer than third longest item</div>
<div id="i5" class="items">well, this is the item that contains larges amount of text</div>
</div>
.container {
background: lightsalmon;
width: 98%;
padding: 15px;
height: 200px; /**/
display: flex;
justify-content: space-between;
}
.items {
background: lightyellow;
margin:5px;
}
#i1 {
flex-basis: 100%; /*100% of what?*/
}
#i2 {
flex-basis: 25%; /*25% of what?*/
}
#i3 {
flex-basis: 45%;
}
解决方案
推荐阅读
- mysql - 子字符串和字符索引的 SQL 语法错误
- macos - 如何将 mac osx 中的弹性堆栈从 6.8.7 升级到 7.x(最新)
- python - 获取文本中“x”个单词的组
- python - 有没有办法使用 Crealytics spark-excel 包将带有 ArrayType 列的 Spark 数据帧写入 Excel?
- networking - 无法与 rtnetlink 对话:不支持操作
- laravel - 如何正确地将排序模型从我的控制器发送到 Laravel API 资源集合?
- sql - 根据折扣查询前 5 名产品和陈列室
- python-3.x - PyCharm 中的 Folium 地图问题
- javascript - 如何在html表格中隐藏元素
- javascript - 如何使用 React Router 返回重定向?