CSS Layout How to - Create Left Panel for Image and right panel for information








Question

We would like to know how to create Left Panel for Image and right panel for information.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#profile_leftPanel {<!-- w  w  w.j  a va2  s . co  m-->
  width: 150px;
  float: left;
  border-right: 1px solid #666;
  margin-right: 20px;
}

#profile_rightPanel_center {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

#recentStatus {
  width: 400px;
  text-align: center;
  display: inline;
}
</style>
</head>
<body>
  <div id="profile_leftPanel">
    <a> <img src="http://placehold.it/300x300" width="122" height="160">
    </a>
  </div>
  <!-- leftPanel end -->
  <div id="profile_rightPanel">
    <div id="profile_rightPanel_center">
      <div id="recentStatus">
        <a class='recentStatus' href=''>Information</a>
      </div>
      <br>This is a test. This is a test. This is a test. 
      This is a test. This is a test. This is a test. 
      This is a test. This is a test. This is a test. 
      This is a test. This is a test. This is a test. 
      This is a test. This is a test. This is a test. 
      This is a test. This is a test. This is a test. 
    </div>
    <!-- _center end -->
  </div>
  <!-- rightPanel end -->
</body>
</html>

The code above is rendered as follows: