HTML Element Style How to - Make div expand entire height








Question

We would like to know how to make div expand entire height.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
body {<!--from w ww  . ja v  a  2 s.co  m-->
  padding: 0;
  margin: 0;
  min-height: 100%;
  min-width: 100;
}

html {
  min-height: 100%;
  min-width: 100%;
  position: relative;
  margin: 0;
}

#nav {
  position: absolute;
  width: 110px;
  min-height: 100%;
  margin: 0;
  padding-top: 10px;
  padding-left: 10px;
  overflow: hidden;
  left: 0;
  top: 0;
  background-color: red;
}

#content {
  background-color: blue;
  width: 500px;
  height: 1000px;
  margin-left: 130px;
}
</style>
</head>
<body>
  <div id="nav">(nav)</div>
  <div id="content">(Content)</div>
</body>
</html>

The code above is rendered as follows: