开发者

How to keep div at the bottom of the window if page not full, otherwise at the end of content

I have a div in a page (footer) and I want the following to happen with CSS:

If the page has not enough content to fill the window, the div should be at the very bottom. If the page has enough content (and a scroll bar perhaps appears) then开发者_如何转开发 I want the div to be after all the content.

If I do it with position absolute etc, I can't get the second case to work.

Any ideas?


I think you're looking for 100% min-height layout. Check out this post: 100% Min Height CSS layout.


You want to use a sticky footer.

For example: http://ryanfait.com/sticky-footer/

or if you google Sticky footer you find a few alternatives

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜