This is normal, and one of the limitations of a "float" based layout- the column heights do not sync up. There are various hacks and JavaScript solutions to this, which you may want to do a search on Google for.
A more elegant, future proof solution is to use CSS flex box if you don't care about IE 10 and below support. The following uses Flexbox to create a two column layout whereby the heights of the column are always the same:
Code:
<!doctype html>
<style>
div.flexcontainer{
display: -webkit-box;
display: -ms-flexbox;
display: flex;
min-height: 100vh; /* set min container height to viewport height */
}
div.columns{
padding: 10px;
box-sizing: border-box; /* make padding part of width declared, not in addition */
}
div.columns:nth-of-type(1){
background: #eee;
-webkit-box-flex: 0;
-ms-flex: 0 0 250px;
flex: 0 0 250px; /* make this flex item 250px wide and non flexing */
}
</style>
<body>
<div class="flexcontainer">
<div class="columns">This is column 1</div>
<div class="columns">This is column 2</div>
</div>
</body>
Bookmarks