I tried searching for what I was looking for, but I kept on finding things for css on internal divs.
Anyway, what I am trying to do is have two columns of divs be aligned with oneanother, with the right column always being aligned to the top of the left column. This is where I am drawing a blank, I can't seem to figure out how to do that.
The size of the left column is dynamic, so I can't use the :height property to keep things in order.
Here is what I am trying to do:
The two or more different div of same height can be put side-by-side using CSS. Use CSS property to set the height and width of div and use display property to place div in side-by-side format. The used display property are listed below: display:table; This property is used for elements (div) which behaves like table.
For aligning columns to the left, the align-content property will set to 'flex-start'. For aligning columns to the right, the align-content property will set to 'flex-end'. For aligning columns to the extreme ends, the align-content property will set to 'space-between'.
You can do this by setting the display property to "flex." Then define the align-items and justify-content property to “center.” This will tell the browser to center the flex item (the div within the div) vertically and horizontally.
What you could do is, wrap the inline div within a transparent div. For Example:
<div class="transparent-container">
<div class="inline-div">
</div>
<div class="inline-div">
</div>
<div class="clearfix"></div>
</div>
You can do this by three ways:
<table>
<tr>
<td><div>div</div></td>
<td><div>div</div></td>
</tr>
<tr>
<td><div>div</div></td>
<td><div>div</div></td>
</tr>
</table>
<div class="outer-container">
<div class="box-container">
<div class="left-box">
Left Box content
</div>
<div class="right-box">
Right Box Content
</div>
</div>
</div>
Calcuate the height by Js of left-box and and then pass that to right-box to maintain the gap.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With