2014-03-13 18 views
0

什么是创建页脚div的正确方法,我通常使用下面的代码来设置我的页脚div,我想知道footer div是如何用行业标准明智地编码的。我将如何设置页脚,以便在内容填满时它可以进入屏幕的底部。正确的(行业标准)设置页脚的方法

这里是我的HTML:

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

这里是我的CSS:

html { 
    background:white; 
    height:100%; 
} 
#wrapper { 
    width:960px; 
    margin-right:auto; 
    margin-left:auto; 
} 
#header { 
    background:#000000; 
    min-height:30px; 
} 
#content { 
    background:orange; 
    min-height:500px; 
    padding:20px; 
} 
#footer { 
    clear:both; 
    background:black; 
    min-height:30px; 
    position:relative; 
} 
+1

'业标准?'没有听说过。 – Praveen

+0

那么我的代码是布局HTML文档的正确方法吗? – chris

回答

0

如果你使用任何HTML版本低于5,那么是不是真的有一个标准,什么你做的和其他许多布局一样好(尽管我总是使用类和从不使用ID - but that's a different topic

如果你使用的是HTML5,应该使用页脚标签。

当使用HTML5,这里的布置您的网页更标准的方法:

<header><nav></nav></header> 
<main></main> 
<footer></footer> 

对HTML5布局的更多信息,请访问:

http://www.developer.com/lang/understanding-the-proper-way-to-lay-out-a-page-with-html5.html

https://www.smashingmagazine.com/2009/08/designing-a-html-5-layout-from-scratch/

相关问题