How to place div side by side

There are many ways to do what you’re asking for:

  1. Using CSS float property:
 <div style="width: 100%; overflow: hidden;">
     <div style="width: 600px; float: left;"> Left </div>
     <div style="margin-left: 620px;"> Right </div>
</div>
  1. Using CSS display property – which can be used to make divs act like a table:
<div style="width: 100%; display: table;">
    <div style="display: table-row">
        <div style="width: 600px; display: table-cell;"> Left </div>
        <div style="display: table-cell;"> Right </div>
    </div>
</div>

There are more methods, but those two are the most popular.

Leave a Comment