Here is example code of what I have:
The CSS:
<style>
* {
box-sizing: border-box;
}
/* Create four equal columns that floats next to each other */
.column {
float: left;
width: 25%;
padding: 10px;
height: 300px; /* Should be removed. Only for demonstration */
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
</style>
The Code:
<h2>Four Equal Columns</h2>
<div class="row">
<div class="column" style="background-color:#aaa;">
<h2>Column 1</h2>
<p>Some text..</p>
<p>Some text..</p>
</div>
<div class="column" style="background-color:#bbb;">
<h2>Column 2</h2>
<p>Some text..</p>
</div>
<div class="column" style="background-color:#ccc;">
<h2>Column 3</h2>
<p>Some text..</p>
<p>Some text..</p>
<p>Some text..</p>
<p>Some text..</p>
</div>
<div class="column" style="background-color:#ddd;">
<h2>Column 4</h2>
<p>Some text..</p>
<p>Some text..</p>
<p>Some text..</p>
</div>
</div>
This is what I don't want:
<div class="row">
<div class="column" style="background-color:#aaa;">
<h2>Column 1</h2>
<h2>Column 1</h2>
<p>Some text..</p>
<p>Some text..</p>
</div>
<div class="column" style="background-color:#bbb;">
<h2>Column 2</h2>
<p>Some text..</p>
</div>
When you add more titles (h2 tags) into the box, it'll push the text down in that box but the other boxes remain the same. This renders everything uneven, meaning, if there's more text in one box then makes all of the other boxes look weird.
How do I make it so that if one box has a longer title that the other text in the other four boxes will move down their contents to match the height of the box with the most text?
Like this:
I would prefer to do this using only HTML/CSS.