CSS:将Div高度设置为100% - 像素 [英] CSS: Set Div height to 100% - Pixels

查看:204
本文介绍了CSS:将Div高度设置为100% - 像素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面上有一个标题刚刚超过100px(111像素)
下面的div需要延伸到视口的底部,好像我已经将底部设置为0px。问题在于我不能在ie6(bug)中指定顶部和底部。

I have a header on my page which is just over 100px (111px to be exact) The div below it needs to extend to the bottom of the viewport, as if i had set the bottom to 0px. The problem lies in the fact that i cannot specify top and bottom in ie6 (bug).

我可以指定top:111px或bottom:0px,高度是正确的。 100%-111px。

I can either specify top: 111px or bottom: 0px, but i still need the height to be correct ie. 100% -111px, according to the size of the viewport.

似乎无法使表达式工作coz似乎是解决方案

Can't seem to get expressions working coz that seems to be the solution

这是我的CSS代码:

position: absolute; 
width: 200px; 
top: 111px; 
bottom: 0px;

有任何建议吗?

推荐答案

我已将高度属性添加到正文 html 标签。

I added the height property to the body and html tags.

HTML:

<body>
<div id="wrapper">
 <div id="header">header</div>
 <div id="content">content</div>
</div>

CSS:

html, body
{
    height: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
}
#wrapper
{
    height: 100%;
    min-height: 100%;
}
#header
{
    height: 111px;
}

这篇关于CSS:将Div高度设置为100% - 像素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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