Per the suggestions of @Ria Elliger, utilizing a table-layout can achieve the desired result.
It is advisable to create an additional element for the table. This will enable you to center align the table, as illustrated in your image:
<div class="con">
<div id="table">
<div>gdsgsdg sg sdg sdf gdf gd fg dfg</div>
<div>sdfkjsd kfjsdf sdfj sdfj sdlk fslkd fskldf sdf sdf sd f</div>
<div>gdsgsdg sg sdg sdf gdf gd fg dfg</div>
<div>gdsgsdg sg sdg sdf gdf gd fg dfg</div>
<div>gdsgsdg sg sdg sdf gdf gd fg dfg</div>
</div>
</div>
Each div within the table functions as a table-cell
:
#table > div {
/*display: inline-block;*/
border: 1px solid gray;
width: 50px;
display: table-cell;
vertical-align: bottom;
}
By default, the table-cell
is aligned to the top. To make it extend to the bottom, you can use vertical-align: bottom;
Now, you can vertically center align the table within its parent element:
#table
{
display: table;
margin: auto;
border-spacing: 5px 0;
}
The usage of border-spacing
allows for clear separation between each cell, applied to the left and right sides of each cell.