min-height 和 max-height 属性 值之间的实现差异
Implementation difference between min-height and max-height property value
正如我们在附图中看到的,当我们应用 min-height: none
是 无效语法 而 max-height: none
是 有效语法。而max-height: auto
是无效语法,min-height: auto
是有效语法.
但是当我查看文档 min-height, max-height 时,它指出:
none:
No limit on the size of the box.
我无法在 w3c 上找到确切的实现细节。 任何人都知道为什么在 min-height
和 max-height
属性 值中应用了这个相反的概念? 或者,这只是浏览器错误没有实现他们?
有人可能会说文档说明了 none
值是什么,我们不应该担心。但我问这个是因为文件中有语法错误可能意味着影响性能 - 不过,这只是一点意见。
如果你勾选CSS2 specification,你可以读到:
none
(Only on 'max-height') No limit on the height of the box.
none
不是 min-height
的有效值(也是 min-width
)并且 auto
不是两者的有效值。
auto
值是在 Box Sizing Module Level 3 中引入的,而不是 min-height
的默认 0
值
Note: The initial value of auto is new; in [CSS2] the initial value was zero.
为 min-height
/min-width
引入 auto
值是因为 Flexbox 和 CSS 网格,其中 auto
值不会计算为0
Note: The auto keyword, representing an automatic minimum size, is the new initial value of the min-width and min-height properties. The keyword was previously defined in this specification, but is now defined in the CSS Sizing module. ref
Note: The auto value of min-width and min-height affects track sizing in the relevant axis similar to how it affects the main size of a flex item. See §6.6 Automatic Minimum Size of Grid Items. ref
我认为我们可以假设在 Flexbox 和 CSS 网格范围之外,auto
将计算为 0
正如我们在附图中看到的,当我们应用 min-height: none
是 无效语法 而 max-height: none
是 有效语法。而max-height: auto
是无效语法,min-height: auto
是有效语法.
但是当我查看文档 min-height, max-height 时,它指出:
none:
No limit on the size of the box.
我无法在 w3c 上找到确切的实现细节。 任何人都知道为什么在 min-height
和 max-height
属性 值中应用了这个相反的概念? 或者,这只是浏览器错误没有实现他们?
有人可能会说文档说明了 none
值是什么,我们不应该担心。但我问这个是因为文件中有语法错误可能意味着影响性能 - 不过,这只是一点意见。
如果你勾选CSS2 specification,你可以读到:
none
(Only on 'max-height') No limit on the height of the box.
none
不是 min-height
的有效值(也是 min-width
)并且 auto
不是两者的有效值。
auto
值是在 Box Sizing Module Level 3 中引入的,而不是 min-height
的默认 0
值
Note: The initial value of auto is new; in [CSS2] the initial value was zero.
为 min-height
/min-width
引入 auto
值是因为 Flexbox 和 CSS 网格,其中 auto
值不会计算为0
Note: The auto keyword, representing an automatic minimum size, is the new initial value of the min-width and min-height properties. The keyword was previously defined in this specification, but is now defined in the CSS Sizing module. ref
Note: The auto value of min-width and min-height affects track sizing in the relevant axis similar to how it affects the main size of a flex item. See §6.6 Automatic Minimum Size of Grid Items. ref
我认为我们可以假设在 Flexbox 和 CSS 网格范围之外,auto
将计算为 0