Match the height of HTML elements

This tutorial explains how you can match the height of several HTML elements when their content does not have the same height.

Open the JavaScript configuration file lib/js/template.js. In there, take a look at the function matchHeights:

matchHeights: function() {
	YOOBase.matchHeight('div.headerbox div.deepest', 20);
	YOOBase.matchHeight('div.topbox div.deepest', 20);
	YOOBase.matchHeight('div.bottombox div.deepest', 20);
	YOOBase.matchHeight('div.maintopbox div.deepest', 20);
	YOOBase.matchHeight('div.mainbottombox div.deepest', 20);
	YOOBase.matchHeight('div.contenttopbox div.deepest', 20);
	YOOBase.matchHeight('div.contentbottombox div.deepest', 20);
}

The "20" at the end means that the minimum height of all DIVs gets set to 20 pixels. You can simply add a line to match your HTML elements. For example:

YOOBase.matchHeight('li.myselector');

Now all li tags with the CSS class "myselector" will be checked for their heights, and the biggest height will be set for all of them.

When a user has JavaScript switched off, the heights of the elements will not be reset but stay as high as the content inside of them.