Page Widget How to - Create layout with two columns, sidebar column must be 100% wide








Question

We would like to know how to create layout with two columns, sidebar column must be 100% wide.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#container {<!--  w w w .j ava2s.  co m-->
  width: 100%;
}

#sidebar, #content {
  height: 200px;
}

#sidebar {
  background: yellow;
  width: 200px;
  float: left;
}

#content {
  background: orange;
}
</style>
</head>
<body>
  <div id="container">
    <div id="content">
      content
      <div id="sidebar">sidebar</div>
    </div>
  </div>
</body>
</html>

The code above is rendered as follows: