Css 内容分区100%高度延伸太远

Css 内容分区100%高度延伸太远,css,html,Css,Html,当内容本身没有扩展到页面底部时,我在让内容容器div正确扩展到页面底部时遇到了一些问题。如果内容较短且未填满页面,则容器仍会延伸到页面底部 结构如下: 调整并将其添加到混合物中: html { height: 100%; min-height: 100; /* min-height is for FF */ } #content { height: -webkit-calc-height(100% - 37px); } /* be sure to add all vendor prefixe

当内容本身没有扩展到页面底部时,我在让内容容器div正确扩展到页面底部时遇到了一些问题。如果内容较短且未填满页面,则容器仍会延伸到页面底部

结构如下:


调整并将其添加到混合物中:

html { height: 100%; min-height: 100; /* min-height is for FF */ }
#content { height: -webkit-calc-height(100% - 37px); } /* be sure to add all vendor prefixes, also change 37px to the correct height of elements above the #content */

您是否确实在codediv id=“centerit”/div>中错过了一个
?或者这是一个复制/粘贴错误?发生的情况是,content div实际上获得了100%的html,并且因为在内容之前有元素,所以页面将100%加上内容之前和之后这些元素的高度。如果你能展示你想要实现的设计,也许可以通过另一种方式实现。不要在你做的每一行上都使用换行符,一开始它看起来有点整洁,但从长远来看,通读它只是一种痛苦。啊,是的,很抱歉centerit部门的复制和粘贴错误。这是一个wordpress网站。我有一个带有横幅图像和导航的页眉,然后是显示帖子的内容,然后是浮动到底部的页脚。我想内容区(背景色)填补未使用的空间时,文章是简短的。以下是网站:
body{background:url(bg.jpg);font-family:verdana, helvetica, sans-serif;font-size:12px;line-height:18px;color:#b3b3b3;height:100%;min-height:100%;}

    a{color:#fff;text-decoration:none;font-weight:bold;outline:none;}

    /* a:hover{color:#289bc6;} */

html { height: 100%; }
    #container{width:1200px;margin:auto;height:100%;position:relative;}

    #logo{font-size:18px;line-height:37px;color:#222;float:left;display:block;clear:both;}

    #nav{margin:auto;background:#000;padding;2px 800px 0px 0px;width:800px;}

    #nav li{display:inline;background:#000;}

    #nav li a{padding:9px 40px 10px 3px;font-weight:normal;color:#fff;background:#000;text-transform:uppercase;line-height:40px;}

#nav li a:hover, #nav li .active, #nav .current_page_item a, #nav li a.current_page_item{background:#fff;color:#000;}

    /* #nav li a:active{background:#289bc6;} */

    .clear{clear:both;}


    .spacer{height:10px;}

    .content{margin:auto;width:800px;height:100%;display:block;clear:both;position:relative;}

.sidebar{margin:auto;padding:10px;width:780px;background:#000;}

.sidebar h3{padding:5px 5px 4px 5px;background:#fff;color:#000;text-transform:uppercase;font-weight:normal;}

    #categories{border-bottom:1px solid #fff;line-height:21px;}

    #categories li{display:inline;margin:0 5px 0 0;}

    #categories li a{padding:5px;color:#fff;text-transform:uppercase;font-weight:normal;}

    #categories li a:hover, #categories li b{padding:5px 5px 4px 5px;background:#fff;color:#000;text-transform:uppercase;font-weight:normal;}

    /* #categories li a:active, #categories li b:hover, #categories li b:active{background:#289bc6;} */



                .post{background:#000;position:relative;clear:both;display:block;clear:both;width:800px;min-height:100%;margin-bottom: 30px;}

    .post .left{width:100px;float:left;margin-top:-10px;height:100%;}

    .post .left h5{font-weight:normal;line-height:72px;font-size:72px;margin-top:10px;}

    .post .left b{font-weight:normal;font-size:25px;line-height:25px;margin-top:-200px;}

    .post .right h2 a{text-transform:uppercase;padding:3px;font-weight:normal;font-size:30px;line-height:32px;}
    .post-390 .right h2 a {display: none;}

    .post .right h2 a:hover{text-decoration:underline;}

    .post .right{width:760px;height:90%;float:left;margin-left:10px;}



    .sidebar ul{line-height:21px;}

    .sidebar ul li{display:inline;margin:0 5px 0 0;}

    .sidebar ul li a{padding:5px;color:#fff;text-transform:uppercase;font-weight:normal;display:block;}

    .sidebar ul li a:hover{padding:5px;background:#fff;color:#000;text-transform:uppercase;font-weight:normal;}



    .footerul{line-height:21px;background:#000;}

    .footerul li{display:inline;margin:0 5px 0 0;}

    .footerul li a{padding:5px;color:#fff;text-transform:uppercase;font-weight:normal;display:block;}

    .footerul li a:hover, .footerul li b{padding:5px 5px 4px 5px;background:#fff;color:#000;text-transform:uppercase;font-weight:normal;}

    /* .footerul li a:active, .footerul li b:hover, .footerul li b:active{background:#289bc6;} */

    /* .footerul li b{border-bottom:1px solid #fff;width:100%;}*/



    #fleft{width:100%;float:left;}

    #fright{width:48%;float:right;}



    #centerit{text-align:center;background:#000;padding:10px 0px 10px 0px;position:fixed;bottom:0;width:800px;}



.commentlist li{padding:10px;background:#eee;}

.commentlist li.alt{background:#ddd;}

.alignright {float:right;}

.alignleft {float:left;}
html { height: 100%; min-height: 100; /* min-height is for FF */ }
#content { height: -webkit-calc-height(100% - 37px); } /* be sure to add all vendor prefixes, also change 37px to the correct height of elements above the #content */