It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming CSS Forum

Making a div touch the bottom of the screen

Making a div touch the bottom of the screen

Postby kdjuiopo on Wed Aug 03, 2011 3:59 am

Hi

I've been web developing for a while but have never seemed to be able to work this out.. Does anyone know how to get a div to be the full height of the users screen as a default. I've tried setting the body to height:100% and then setting the div height to 100% but it's not happy.

I also thought of adding a min-height but that would mean unnecessary scroll on certain screens.

Any help much appreciated
kdjuiopo
50+ Club
 
Posts: 90
Joined: Fri Jul 01, 2011 1:32 am

Re: Making a div touch the bottom of the screen

Postby rajmv on Wed Aug 03, 2011 2:55 pm

Code: Select all
<html>
<head>
<script type="text/javascript"><!--
  window.onresize = function () {
    var d = document.getElementById ('wholescreen');
    d.style.height = window.innerHeight + 'px';
  };

  function startApp() {
    window.onresize();
  }
--></script>
</head>
<body onload="startApp();">
  <div id="wholescreen" style="position:absolute;"> </div>
</body>
</html>
rajmv
100+ Club
 
Posts: 103
Joined: Thu Jul 14, 2011 7:22 am


Who is online

Users browsing this forum: No registered users and 0 guests