微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

CSS 100%身高和身材

在100%的总体布局中,我有一个问题使我的一个元素100%.

我尝试了不同的定位解决方案,我最终会隐藏内容,底部的页脚后面的浮动,或者内容最终落在页脚后面,并在页脚后面继续.

这是我的页面布局.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">

<head>
<style>
    *{margin:0}
    html,body{margin:0; padding:0; height:100%}
    .wrapper{position:relative; margin:0 auto -200px; height:auto !important; height:100%; min-height:100%}
    .container{width:930px; margin:0 auto; text-align:left}
    .right{float:right; width:680px; background:#FFF; margin:60px 10px 0 0; padding:0}
    .left{float:left; width:240px}
    .content{padding:10px}
    .footer{position:absolute; width:100%}
    .footer,.push{height:200px}
</style>
</head>

<body>

<div class="wrapper">
<div class="container">
<div id="left">
   left
</div>
<div class="right">

<div class="content">
    content
</div>

</div>
<div class="push"></div>
</div>
<div class="footer">
    footer
</div>
</div>

</body>
</html>

页面的布局是100%的高度和页脚在底部工作它只是div与类名称内容,我想要是100%,并且如果内容到达页脚,而不是消失,进一步向下推页脚.

任何帮助最感激.

http://img686.imageshack.us/img686/7725/screenshotbj.png

解决方法

回答animuson:实际上以下代码是IE6支持所必需的:
min-height: 100%; /* real browsers */
height: auto !important; /* real browsers */
height: 100%; /* IE6: treated as min-height*/

IE6不明白!重要,但它确实将高度视为最小高度.所以为了支持IE6和现代浏览器,你必须使用完全相同的代码(顺序很重要).

原文地址:https://www.jb51.cc/css/214335.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。