比如,浏览器的限制是什么?如果我有99999999999999vh它实际上是99999999999999vh还是会像2145629vh那样奇怪?
解决方法
从视口高度(vh)
specification,它没有提到最小值/最大值的限制.但是,在
Section 5 of CSS Values and Units: Numeric Data Types年,它提到:
CSS theoretically supports infinite precision and infinite ranges for all value types; however in reality implementations have finite capacity. UAs should support reasonably useful ranges and precisions.
和一些SO users do test the limit of values of each browsers,结果如下:
Firefox: 33554400px Chrome: 33554428px Opera: 33554428px IE 9: 21474836.47px
以上行为在Section 5: Distance Units中解释:
While some properties allow negative length values,this may complicate the formatting and there may be implementation-specific limits. If a negative length value is allowed but cannot be supported,it must be converted to the nearest value that can be supported.
希望以上可以回答你的问题.