为什么minmax(0,1fr)对长元素有效而1fr不起作用?
问题说明
所以我有这个网格:
--------- ------------------------------ ---------
| <div> | <p> - 1000 characters long | <div> |
--------- ------------------------------ ---------
在 p
里面有一个超长字符串,没有空格. div
是具有固定尺寸的占位符.产生上面的内容:
Inside p
there's super long string with no spaces. div
s are placeholders with fixed dimensions. This produces the above:
display: grid;
grid-auto-flow: column;
grid-template-columns: auto minmax(0, 1fr) auto;
但是将 minmax(0,1fr)
更改为 1fr
可以得到以下效果:
But changing minmax(0, 1fr)
to 1fr
gives this:
--------- ----------------------------------------
| <div> | <p> - 1000 characters long | <div> |
--------- ----------------------------------------
它溢出其父级并且超出屏幕大小.为什么它的行为不像minmax?
It overflows out of its parent and way out of screen size. Why isn't it behaving like minmax?
正确答案
默认情况下,因为 1fr
等效于 minmax(auto,1fr)
.
Because 1fr
is equivalent to minmax(auto, 1fr)
, by default.
使用 minmax(0,1fr)
时,与独立的 1fr
有所不同.
When you use minmax(0, 1fr)
, that's something different than standalone 1fr
.
在第一种情况下,轨道不能小于网格项目的大小( min 大小为 auto
).
In the first case, the track cannot be smaller than the size of the grid item (min size is auto
).
在第二种情况下,可以随意将轨道的大小调整为0的宽度/高度.
In the second case, the track is free to resize to a 0 width/height.
更多详细信息:
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcgckhe
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20 -
希伯来语的空格句子标记化错误
it1352 06-22