100% height sidebars without images or unsemantic elements

One really sucky thing about CSS is it's lack to make stuff 100% height. You'll face this especially with sidebars, if there is not enough content to fill the sidebar, it falls short and looks ugly. Luckyly there are workarounds.

Requirements for our 100% height sidebar techniques:

  • No images
  • No unsemantic elements
  • Support for IE8

The `display:table;` method

This works like a table layout, but without the table. We can set 100% height to all the elements. Check the commented code under the html and css tabs.

You can strip out either one of the sidebars and it still works.

Check out this Pen!

The pseudo elements method

This is a bit more “hack-y” in a way, but works great. You just fixed position the sidebar pseudo elements. Downside to this technique is that you can’t animate the sidebars (if you need to get the sidebars out of the way by toggling their visibility). See the commented code under the css and html tabs.

Check out this Pen!

One day the flexbox method will gain browser support and we can use it. Meanwhile, we have to use these.

Club-Mate, the beverage → club-mate.fi