Say I have a code like:

<div id="mydiv">This text is supposed to stay at the bottom of the window regardless of scrolling</div>

How can I program that (or use css) to keep at the bottom of my browser window, even when scrolling?

Help is very much appreciated

Recommended Answers

All 3 Replies

<div class="stickyFooter">This text should stay at the bottom of the screen.</div>
.stickyFooter{
    position:fixed;
    width:100%;
    bottom:0;
}

That text stays fixed at the bottom of the screen.

commented: Only comment that correctly addressed OP's request. +4

I have used this approach several times. Adapted from: http://ryanfait.com/resources/footer-stick-to-bottom-of-page/

<!DOCTYPE html>
<html>
<head>
<style>
* {margin: 0;}
html, body {height: 100%;margin: 0;}
.wrapper {min-height: 100%;height: auto !important;height: 100%;margin: 0 auto -100px;}
.footer{height:100px;background:#ababab;}
</style>
</head>

<body>
  <div class="wrapper">
     <p>Page Content</p>
  </div>
  <div class="footer">
     <p>Footer Content</p>
  </div>
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.