html - 分区高度 100%

标签 html css layout posterous

我知道这个问题已被问过一百万次,但我并没有多少运气让它发挥作用。我正在研究一个 Posterous 布局,我正试图让我可能的内容流到底部。

这是 layout so far 的链接

您可以看到内容保存在 center_col 中,所以我基本上需要将此列延伸到页面/窗口的底部,而不管其中有多少内容。

这是当前的 HTML:

<!DOCTYPE html>
<html>
    <head>
        <title>{Title}</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
        <style type="text/css"> 
            * {margin:0;padding:0}/* mac hide \*/
            html { height: 100%;}
            * html #wrap {height: 100%;}/* end hide */
            body {  
                background: #FFFFFF;   
                color: #fff;  
                height:100%;    
                min-width:800px;}
            #inner {
                position:relative;
                width:100%
            }
            #wrap {    
                min-height: 100%;    
                margin-left:50%;    
                position:relative;    
                background:#F9F9F9;    
                color:#000;    
                z-index:1
            } 
            #center_col {    
                float: left;    
                width: 800px;
                height: auto;
                margin-left:-380px;/* drag it central on the page*/    
                position:relative;    
                display:inline;/* ie double margin bug*/    
                background:#FFFFFF;
            }
            #sidebar {                            
                width:204px;
                height: 100%;
                padding-right:26px;     
                float:left;     
                min-height:234px;     
                position:relative;     
                background: #FFFFFF; 
            } 
            #content {                             
                width:570px;
                height: 100%;
                min-height: 100%;    
                position:relative;     
                float:left;     
                background: #F9F9F9 url('http://www.rockettree.com/images/bg-content.png') left top repeat-y;   
                padding-top:21px;     
                padding-bottom:48px; 
            }
            .postunit {                         
                width: 500px; 
                margin-left: 30px; 
                padding: 10px 5px 20px 5px;
                background: #FFFFFF;
                border: 1px solid #F9F9F9;
             }
            .sidebar {                        
                border: 1px solid #000000;
                background-color: #FFFFFF; 
                margin-top: 50px;
                padding-left: 10px;
                float: left; 
                height: auto;
                width:200px;
                -moz-border-radius: 10px;
                border-radius: 10px;
            }
            p{
                padding:5px;
                margin-bottom:1em;
            }
        </style> 
        <!--[if IE]><style type="text/css">body {width:expression( documentElement.clientWidth < 802 ? (documentElement.clientWidth == 0 ? (body.clientWidth < 802 ? "802" : "auto") : "802px") : "auto" );}</style><![endif]-->  
    </head> 
    <body> 
        <div id="wrap">     
            <div id="inner">        
                <div id="center_col">             
                    <div id="sidebar">                
                        <div class="header">
                            <h1>{Title}</h1>
                            <p>{Description}</p>
                        </div>
                        {block:ListSidebar}
                        <div class="profile">
                            <a href="{ProfileLink}">
                                <img src="{PortraitURL-45}" width='75' height='75'>
                            </a>
                            <p>{Profile}</p>
                        </div>
                        {/block:ListSidebar}
                    </div>
                    <div id="content">

                        <div class="posts">
                            {block:Posts}

                            <div id="postunit_{PostID}" class="postunit">
                                {block:EditBox/}

                                <div class="post">                        
                                    <h3><a class="posttitle" href="{Permalink}">{Title}</a></h3>
                                    <a class="button" href="{Permalink}">Posted {TimeAgo}</a>
                                    {Body}
                                </div>
                                {block:Responses}
                                {block:ResponsesList}
                                {/block:ResponsesList}
                                {block:Sharing}
                                {block:Tweet /}&nbsp;{block:FbLike /}
                                {/block:Sharing}
                                <div class="postresponses">
                                    <a class="button" href="#">{ResponseCount} Response{ResponseCountPluralized}</a>
                                </div>
                                {block:ResponsesShow}
                                {Responses}  
                                {ResponseForm}  
                                {/block:ResponsesShow} 
                                {/block:Responses}
                            </div>

                            {/block:Posts}
                        </div>

                        {block:Pagination/}

                    </div>         
                </div>     
            </div>
        </div> 
    </body> 
</html>

最佳答案

将#center_col div 的包含元素的高度设置为 100%。我对此进行了测试,它成功了!

关于html - 分区高度 100%,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5129906/

相关文章:

HTML+CSS : List with submenu problems

css - 如何对齐窗体中的两个命令按钮

jquery - <svg> 掩码在用于在 react.js 中显示 svg <image> 时不起作用

android - 复选框文本显示在框顶部

css - 为不同屏幕尺寸构建网站的最佳实践

javascript - 用于验证的 jQueryUI 工具提示

html - 如何使用 cherrypy 将 mysql 数据库表中的值显示到 html 页面中?

css - 左对齐和右对齐在同一行上的跨浏览器 CSS

html - float 在 div 中不起作用

html - 在我的横幅中的两个按钮之间创建一个空格