HTML Element Style How to - Float Multiple FLOAT DIV and BORDER








Question

We would like to know how to float Multiple FLOAT DIV and BORDER.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
div#container {<!--from  w  w w  .j a v  a 2  s .  com-->
  height: 200px;
}

div#left {
  float: left;
  width: 80%;
  height: 100%;
  background: red;
}

div#inner_left {
  border-right: 4px solid black;
  height: 100%;
}

div#right {
  float: left;
  width: 20%;
  height: 100%;
  background: green;
}
</style>
</head>
<body>
  <div id="container">
    <div id="left">
      <div id="inner_left">content left</div>
    </div>
    <div id="right">content right</div>
  </div>
</body>
</html>

The code above is rendered as follows: