How to Set Height of a div same as the Screen Height

时光总嘲笑我的痴心妄想 提交于 2019-12-25 01:41:31

问题


I need a div height changable if the screen size changes.

I also need that div is scrollable because the content may be Large.
But only when it is larger than the screen zize.

Also it should Work on IE6

Is there any Possibility for that?

If yes,
Please Give me the Complete css, html and javascript.


回答1:


set width 100%; It's works

body {
width:100%;
height:100%;
}

#wrapper {
width:100%;
background:#ccc;
}



回答2:


if the div is a direct child of body than just set height: 100% on both the div and the body. Like this:

body, #your-div-id {
   height: 100%;
}

As far the scrillability is concerned just go:

#your-div-id {
   overflow: auto;
}

Makes sense to you?



来源:https://stackoverflow.com/questions/6675961/how-to-set-height-of-a-div-same-as-the-screen-height

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!