开发者

how to set footer at bottom?

开发者 https://www.devze.com 2023-01-12 03:46 出处:网络
following is my code html: <div id=\"content\"> <div id=\"A\"> A </div> <div id=\"B\">

following is my code

html:

<div id="content">
<div id="A">
A
</div>
<div id="B">
B
</div>
</div>
<div id="footer">
  footer
</div>

css:

#content{
  width:600px;
}
#A{
  position:relative;
  float:left;
  background:#0000ff;开发者_运维问答
  width:300px;
  height:600px;
}
#B{
  position:relative;
  float:right;
  background:#00ff00;
  width:300px;
  height:100px;
}
#footer{
  background:#ff0000;
}

I want to set footer at bottom,but footer is just under the div B.

when I use float:left for footer,though the footer is at bottom,I have to set width for footer,but I want to let footer's width is equal to browser window's width.

then how can I set footer at bottom and set footer's width equal to the browser window's width? any suggestion is appreciated.


You could add a clearing element to behind your content div. THis element must clear floating (clear: both) in order to let the footer appear at bottom.

edit: Have a look here

0

精彩评论

暂无评论...
验证码 换一张
取 消