Currently, I am designing a layout that includes multiple tables. My goal is to display them in a more readable format rather than having them stacked on top of each other. To achieve this, I am utilizing the div tag to create cells of various sizes per row. Additionally, I want the tables within the div tags to be aligned vertically, so I have applied the display:table-cell style.
However, I have encountered an issue where the first "table row" behaves as expected, but the second table row ends up squishing everything to the left. I have created a JSFiddle demo to illustrate this problem. What could I be missing or doing incorrectly?
Sample HTML:
<div class="TR">
<div class="TD" style="width:40%;">
Info
</div>
<div class="TD" style="width:20%;">
Some info
</div>
<div class="TD" style="width:40%;">
More info
</div>
</div>
<br />
<div class="TR">
<div class="TD" style="width:50%;">
Info 1
</div>
<div class="TD" style="width:50%;">
Info 2
</div>
</div>
<br />
CSS Style Applied:
div.TR {
background-color:blue;
display: table-row;
}
div.TD {
background-color:red;
display: table-cell;
vertical-align: middle;
border: 1px solid black;
}