CSS 允许的最大高度(以像素为单位)
我知道不同的浏览器可能有不同的上限值,但是对于给定浏览器中最大可渲染 CSS 高度/宽度的良好经验法则是什么?
例如,这个技巧:
.parent{
overflow: hidden;
}
.column{
float: left;
}
.max-height{
margin-bottom: -30000px;
padding-bottom: 30000px;
}
<div class="parent">
<div class="column">
</div>
<!-- given a background color, this div will appear to expand to 100% the
parent height -->
<div class="column max-height">
</div>
</div>
我知道这几乎是愚蠢的,但是如果页面扩展到超过 30000px
,那么现在这个技巧就不起作用了。
我见过 32768px
在不同的地方使用;这是因为较高的值不可靠,还是只是因为它是一个很好的平方数?
I understand that different browsers are likely to have different ceiling values, but what is a good rule of thumb for the maximum render-able CSS height/width in a given browser?
For example, this trick:
.parent{
overflow: hidden;
}
.column{
float: left;
}
.max-height{
margin-bottom: -30000px;
padding-bottom: 30000px;
}
<div class="parent">
<div class="column">
</div>
<!-- given a background color, this div will appear to expand to 100% the
parent height -->
<div class="column max-height">
</div>
</div>
I know it's nearly stupid, but if a page were to expand beyond 30000px
, now the trick doesn't work.
I've seen 32768px
used in various places; is this due to higher values being unreliable, or just because its a nice square number?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我很想看看屏幕对象可用高度中的javascript可以返回哪些值
使用jquery,如果您将它们作为变量传递,则可以使用.css函数将主体高度和宽度设置为这些值,例如。
当然,这假设客户端浏览器上启用了 javascript
I'd be tempted to have a look at what values can be returned from javascript in the screen object available height
Using jquery you could set the body height and width to these values using the .css function if you pass them in as variables such as.
of course this assumes if javascript is enabled on the clients browser