如何使全屏幕div,并防止大小由内容更改? [英] how to make a full screen div, and prevent size to be changed by content?

查看:194
本文介绍了如何使全屏幕div,并防止大小由内容更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的web应用程序,我想主div是全屏幕(宽度和高度= 100%),无论内容,我希望它保持在那个大小。这意味着,如果没有太多的内容,它不应该收缩,如果有太多的内容,它不应该推这个主div。

for my web application, i would like the main div to be full screen (both width and height = 100%), and regardless of content, i want it to stay at that size. that means, if there are not much content, it shouldn't shrink, and if there are too much content, it shouldn't push this main div.

如何我这样做?

(我可以用hack应用到这个div,只要它会保持内容不受干扰)

(i'm ok with hacks applied to this div, as long as it will keep contents hack-free)

推荐答案

或甚至:

<div id="full-size">
  Your contents go here
</div>



html,body{ margin:0; padding:0; height:100%; width:100%; }
#full-size{
  height:100%;
  width:100%;
  overflow:hidden; /* or overflow:auto; if you want scrollbars */
}

(html,body可以设置为like。 。95%-99%,或某些这样的情况,以弥补利润率的轻微不一致等)

(html, body can be set to like.. 95%-99% or some such to account for slight inconsistencies in margins, etc.)

这篇关于如何使全屏幕div,并防止大小由内容更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆