CSS Layout How to - Align to left by default








Question

We would like to know how to align to left by default.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#content {<!--from   w  ww . ja va  2 s .c  o m-->
  width: 780px;
  padding: 10px;
  position: relative;
  background: #8b847d;
}

#leftcol {
  width: 500px;
  background: red;
}
</style>
</head>
<body>
  <div id="content">
    <div id="leftcol">
      <p>Lorem Ipsum</p>
    </div>
  </div>
</body>
</html>

The code above is rendered as follows: