To create a two-column layout, you can utilize the inline-block
property along with box-sizing: border-box
for better control of spacing (especially if you have borders).
Check out this live demonstration for reference.
Here's the CSS code:
div {
box-sizing: border-box;
}
div.container {
width: 100%;
position: relative;
border: 1px solid blue;
}
div.left, div.right {
display: inline-block;
width: 50%;
border: 1px solid black;
}
And here's the corresponding HTML structure:
<div class="container">
<div class="left">left</div><div class="right">right</div>
</div>
Keep in mind that intentionally omitting a space between inline elements serves a purpose, as the presence of a space can impact the layout of inline elements.