Member-only story
JavaScript — How to place a div side by side
Nov 2, 2022
Here are 2 ways to place a div side by side.
<div style="width: 100%; overflow: hidden;">
<div style="width: 600px; float: left;"> Left </div>
<div style="margin-left: 620px;"> Right </div>
</div>
2. Using CSS display
property - which can be used to make div
s 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>