浏览器窗口和div的高度 [英] Height of Browser Window and Divs

查看:110
本文介绍了浏览器窗口和div的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试在顶部建立一个固定高度(100像素)的横幅的网站,而我想让其余内容填充页面的其余部分。我有它,所以我有横幅是在一个div,其余的页面在另一个div,我想让页面的其余部分的高度小于100px(100% - 100px)。显然你不能混合%和px当谈到高度。但是,可以定义一个变量为窗口高度(100%)减去横幅高度(100px),然后使用它来定义剩余div的高度。

I am currently trying to build a website with a banner of a fixed height (100px) at the top, and I want the rest of the content to fill the rest of the page. I have it so that I have the banner is in a div, and the rest of the page in another div, and I want the rest of the page to be the height less 100px (100% - 100px). Obviously you cannot mix % and px when it comes to height. However, is it possible to define a variable to be the widow height (100%) minus the banner height (100px) and then use this to define the height of my remaining div.

我是新的css,html,几乎不知道任何其他语言,所以请尝试保持答案简单,因为我是一个简单的人!

I am new to css, html and hardly know any other languages, so please try to keep answers simple, as I am a simple person!

推荐答案

高度是动态的,因此当您向内容部分添加内容时,持有它的contianer的大小也会是这样。

Height is dynamic so that as you add content to your "content section", so will the size of the contianer thats holding it.

简短的回答是,不要为您的内容部分设置高度。

The short answer is, dont set a height for your "content section".

这篇关于浏览器窗口和div的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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