使上部Div与ViewPort的高度相同 [英] Make upper Div the same height as ViewPort

查看:80
本文介绍了使上部Div与ViewPort的高度相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

各个团体

我有一个HTML结构,类似于

hi every body
I have a HTML structure, something like

<body>
<div id="upperWrapper">
   <%--some elements here!--%>
</div>
<div id="main Container">
   <%--some other elements--%>
</div>
</body>

Now I want the "upperWapper" height be the same size as my device ViewPort height. I know the JQuery can do this for me ;) but I wonder if there is a pure CSS solution or some better one! any help would be appreciated

推荐答案

阅读本文: http://www.w3schools.com/css/css_positioning.asp [ ^ ]


对于重复的问题感到抱歉,这只是一个错误,但它是我自己找到的解决方案所以我也在这里添加它,可能对其他人有用;)



我应该将div高度设置为:



身高:100vh;



vh的意思是视口高度。
sorry about the duplicated question, it was just a mistake, but it's the solution found by my self so I add it here too, may be useful to some one else ;)

I should set the div height to:

height:100vh;

vh means "viewport Heigh".


这篇关于使上部Div与ViewPort的高度相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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