Chrome 给出了invalid property value
并且不尊重CSS:
grid-template-columns: repeat(auto-fill, minmax(auto, 1fr));
当auto
被替换为min-content
and max-content
.
当它按预期工作时auto
被替换为固定值,例如
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
这令人惊讶,因为两者repeat
and minmax
支持关键词。
html很简单
<div class='wrapper'>
<div>...</div>
<div>...</div>
</div>
and css
.wrapper {
display: grid
grid-template-columns: repeat(auto-fill, minmax(auto, 1fr));
}
使用时auto-fill
or auto-fit
,必须有一个明确的最小尺寸或最大尺寸。
规范中的“确定”意味着:
无需测量内容即可确定的尺寸。
https://www.w3.org/TR/css-sizing-3/#definite https://www.w3.org/TR/css-sizing-3/#definite
当您同时设置minmax
基于内容的大小的参数,如下所示:
grid-template-columns: repeat(auto-fill, minmax(auto, 1fr));
...这违反了规范,因为没有明确的尺寸。
Using min-content
and max-content
出于同样的原因会导致同样的错误。
只要一个值是确定的,并且第一个值不是确定的fr
(见下文),该规则有效。
7.2.2.2.重复填充:auto-fill and auto-fit重复 https://www.w3.org/TR/css3-grid-layout/#auto-repeat
When auto-fill
给出重复次数,如果网格
容器有一个definite https://www.w3.org/TR/css-sizing-3/#definitesize 或 max size 在相关轴上,那么重复次数就是
不会导致网格的最大可能正整数
溢出其网格容器(将每个轨道视为其最大轨道
尺寸函数(如果是确定的)或作为其最小轨道尺寸
否则函数,并采取grid-gap
考虑在内)。
如果任意次数的重复都会溢出,则重复 1 次。
否则,如果网格容器在相关轴上具有明确的最小尺寸,则重复次数是满足该最小要求的最小可能正整数。
否则,指定的曲目列表仅重复一次。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)