DIV
ページのコンテンツが画面の下部を埋めるのに十分な高さを持っている場合、ページの下部にを配置したいDIV
の最後に貼り付ける必要がありcontent
DIV
、高さが十分でないか空の場合、この状況では下部にDIV
貼り付ける必要がありますページの最後まで。
それは私の HTML と CSS です ( http://jsfiddle.net/maysamsh/eWhvs/embedded/result/ )
CSS:
@charset "UTF-8";
*{
padding:0;
margin:0;
color:#FFF;
}
body {
background-image: url(http://ashraafi.com/img/bgpattern.png);
background-repeat: repeat;
}
#wrapper{
min-width:900px;
width: 100%;
background-color:#CCC;
position:relative;
}
#top{
width:inherit;
height:40px;
background-color:#000;
position:relative;
}
#content{
width:inherit;
background-color:#36C;
position:relative;
}
#bottom{
position:absolute;
bottom:0;
left:0;
background-color:#42210b;
width: inherit;
height: 35px;
}
HTML:
<div id="wrapper">
<div id="top">
top
</div>
<div id="content">
content
<p>foo</p>
<p>foo</p>
<p>foo</p>
<p>foo</p>
<p>foo</p>
<p>foo</p>
<p>foo</p>
<p>foo</p>
<p>foo</p>
</div>
<div id="bottom">
bottom
</div>
<div>