CSS Layout How to - Get div tags site-by-site with inline-block display








Question

We would like to know how to get div tags site-by-site with inline-block display.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.child_div {<!--   w w w. ja  va 2s . c o  m-->
  display: inline-block;
  vertical-align: top;
}

div div {
  border: thin black solid
}
</style>
</head>
<body>
  <div class='parent_div'>
    <div class='child_div'>text1</div>
    <div class='child_div'>text2</div>
  </div>
  <div class='parent_div'>
    <div class='child_div'>moretext1</div>
    <div class='child_div'>moretext2</div>
    <div class='child_div'>a l o t m o r e t e x t 3</div>
  </div>
</body>
</html>

The code above is rendered as follows: