html - css 值的限制(左 : - 17000000px; )

标签 html css

在这里 ( http://jsfiddle.net/sgva97xd/5/ ) 您可以看到 left 可能有 1700 万 (!) 的值:

CSS:

#container { 
    position: absolute;
    left:-17000000px; 
} 
#blah { 
    position: absolute;
    left:17000040px; 
}

HTML:

<div id="container"><div id="blah">Blah</div></div>

当我将这些值替换为 1800 万时,它不再起作用(在 Firefox 上)。 topleft 等 CSS 值的确切限制是多少?


注意:能够达到数百万这样的值可能没有用,但这只是为了测试目的。

最佳答案

根据 W3 docs on Values and Units

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.

那么,回答您的问题:top、left 等 CSS 值的确切限制是多少?

没有确切定义的限制。它可能因浏览器而异...

关于html - css 值的限制(左 : - 17000000px; ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25941565/

相关文章:

html - Bootstrap 两列 100% 高度

javascript - 使用 ng-repeat 渲染条件标记

javascript - window.location.href 更改后浏览器后退按钮无法正常工作

html - 可变宽度的固定侧边栏旁边的流动内容

html - 字体未在 HTML 中应用

ASP.NET:如何在 DataBind 期间设置控件的 css 类?

html - CSS div float :left problem, 列有不同的高度

html - 为什么我的动画在 ie 11 中不起作用

css - svg 调整大小不适用于 chrome

html - 在响应式网格上设置 "same height"行部分的仅 CSS 解决方案