How to get Equal Height Panels Columns, Blocks and other Page Elements

The Panels module is my favorite method for creating complex page layouts. Apparently, many web site developers  using Panels seem to have issues getting layouts with equal heights in their columns. There are at least two easy methods to solve the issue, both of which require understanding a bit about the CSS divs, classes and id Panels creates to contain your Panels columns. This same idea can also be generalized to a method for equalizing the heights of any page elements.

A short node

Here is some content that is brief. However, I want the Panels Column this appears to be equal height with the Panels Column next to it.

A tall node

This is another node with more content, creating a taller Panels Region than the node next door.

Frog Kitty!

However, as you can see, the two Panels Regions appear with different heights next to one another.

Another tall node

Here is another tall node.

Frog Kitty!

However, as you can see, these lower two Panels Regions appear with equal heights next to one another.

Another short node

This information in this node is aligned with its neighbor by editing the Panel Regions of both, giving them the same CSS class, and then in the theme's CSS, defining that class to a height equal to the tallest region.

The technique demonstrated above is quite easy, if the user adding content has access to edit the theme's CSS file. In many situations, that is not an option. For cases where editing of the theme's CSS is not possible, the Equal Heights JQuery module can be used. Using the Equal Heights JQuery module is pretty much the same procedure: the user adding the content creates Panels Regions with the same CSS class they want to have matching heights, then the Equal Heights JQuery module provides a page at admin/settings/equalheights where the user can enter the name of the CSS class they used for their Panels Regions:

The Equal Heights JQuery module
The interface at admin/settings/equalheights provided by the Equal Heights JQuery module

A nice aspect of this method is its general application; any nodes, blocks, and other page elements where you have control to provide a CSS class name is able to have height alignment handled more or less automatically. However, this does have a few drawbacks:

  1. Users adding such content must have access to the Equal Heights JQuery administration page;
  2. Users with such permissions need to have general CSS knowledge, as well as understand class naming quidelines to insure their CSS class names all have unique names;
  3. If the content being aligned is not a simple case such as aligning two nodes, instead it is two short nodes in one column and a single taller node in a column next door. Something like this:

A third short node

Not much stuff here.

 

A fourth short node

Not much here either.

A third tall node

Here is a third tall node.

Frog Kitty!

Aligning these three nodes, or similar mixed configurations, you have to edit the CSS file.

Creating column content and layouts such as above is typically only available to site administrators, so the need to edit the theme's CSS is not unreasonable. Although I have not tried it yet, I hear the Skinr module may be a solution in this type of situation.

That pretty much wraps this tutorial up. If you find your situation requires the modifying of theme CSS files, and you are inexperienced in theme CSS modification, I suggest you read my tutorial on making changes to a Drupal theme. It walks you through finding the CSS definition to make changes, and where you should save your over riding changes for maximum flexibility.

If you have any questions related to this tutorial, or would like a clarification in an area, please write a comment.


Comments

great post, do you have css

great post, do you have css examples of how to accomplish making equal panel heights? i've been googling for over an hour and haven't found anything to work.

No I don't have an example

No I don't have an example handy. However, you should just be able to loop at your page in FireBug and figure out which elements need to have height properties set to equal values. That's what I did before I learned of the Equal Heights module.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre>
  • Lines and paragraphs break automatically.
  • Syntax highlight code surrounded by the {syntaxhighlighter OPTIONS}...{/syntaxhighlighter} tags with the rich text editor turned off or set to source mode.

More information about formatting options