HTML Element Style How to - Make div height auto or 100%








Question

We would like to know how to make div height auto or 100%.

Answer


<html>
<head>
<style>
#box {<!--   w  w w. ja  v a2  s.c o  m-->
  width: 200px;
  border: 1px solid grey;
}

.content {
  border: 3px solid rgba(0, 0, 0, .5);
  padding: 10px 20px 10px 12px;
  margin: 15px;
  min-height: 200px;
}
</style>
</head>
<body>
  <div id="box">
    <div contenteditable="true" class="content">content goes here
    </div>
  </div>
</body>
</html>

The code above is rendered as follows: