编辑:我改变.firstlayer的位置,以绝对的解决了这个。这使得设置左/右边距自动不能使容器居中,所以我设置了left:0;和右:0;当我定义宽度并将其标记为重要时,它将容器居中。感谢大家的帮助!HTML中的容器大小?
为了澄清,我试图让延伸到页面的底部。到目前为止,我所有的尝试都失败了。此外,所有高度属性都位于.firstlayer中以实现浏览器兼容性。
注释的截图可以找到here :(我只是现在做布局,所以它看起来很傻)。
我有一个非常愚蠢的问题。我正在一个网页上工作,我试图让一个<span>
区域一直延伸到页面的底部。我在网上寻找答案,而且我确信伊赛特身体和HTML高度为100%和容器高度自动/最小高度为100%,但它仍然只是伸手分页符。
有没有人对如何解决这一问题有什么建议?
我的CSS是在这里:
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video{
border:0 none;
font:inherit;
margin:0;
padding:0;
}
html, body { width:100%; height:100%; }
body { background: #ff8 url("blue.jpg") repeat fixed; font-family: Helvetica, San-Serif; }
/*----- GRID -----*/
.container {
background: none;
overflow: none;
display: block;
z-index: 1;
}
.firstlayer {
background-color: #fff !important;
height: auto !important;
min-height: 100%;
height: 100%;
width: 960px;
margin:0 auto;
border-left: solid 1px #000; border-right: solid 1px #000;
}
.padded {margin-left:20px; margin-right:20px;}
span { height:auto; }
.onecol { width:8.33%; float:left; }
.twocols { width:16.66%; float:left; }
.threecols { width:25%; float:left; }
.fourcols { width:33.33%; float:left; }
.fivecols { width:41.66%; float:left; }
.sixcols { width:50%; float:left; }
.sevencols { width:58.33%; float:left; }
.eightcols { width:66.66%; float:left; }
.ninecols { width:75%; float:left; }
.tencols { width:83.33%; float:left; }
.elevencols { width:91.66%; float:left; }
.allcols { width:100%; float:left; }
footer {
font-size: 0.75em;
color: #fff;
background: 100px #000;
padding:10px 20px 10px 20px;
bottom: 0px;
height:7em;
}
而我的HTML代码是在这里:
<!--Begin the content area-->
<span class="container firstlayer">
<span class="container padded">
<!--TITLE AND SUBTITLE-->
<span class="container allcols">
<h1>Stand-in Title</h1>
<h1 class="subtitle">Stand-in Subtitle</h1>
</span>
<!--MEDIA PLACEHOLDER-->
<span style="height:400px; background-color:#000;" class="container allcols">
</span>
<!--ROW ZERO: 2 COLS-->
<span class="allcols" style="padding-top:1em;">
<span class="container sixcols">
<h2>Subtitle</h2>
<p> Lorem ipsum </p>
</span>
<span class="container sixcols">
<h2>Subtitle</h2>
<p> Lorem ipsum </p>
</span>
</span>
</span>
</span>
尝试删除'span {height:auto; }'line – Hope4You
如果我理解正确,你试图让媒体容器根据窗口大小扩展它的高度吗? – Keith
你应该使用'div'来代替'span'。 'div'是合适的包装容器,因为它们是“块”级元素。'span'不适合包装容器,因为它们是“内联”元素。参见[W3规范](http://www.w3.org/TR/html401/struct/global.html#h-7.5.4)。 – Sparky