Equal height boxes with CSS

This is a box

This box has less content than the one next to it, but both boxes will still have equal height. No background-image trickery.

This is another box

This box has more content than the others. If all boxes were table cells, the cell with the most content would decide the height of all cells. It works like that here too, but this is not a table.

Instead, display:table, display:table-row and display:table-cell are used to make divs behave like table cells. Excellent. Too bad it doesn’t work in you-know-which-browser. It does, however, work in modern browsers like Mozilla, Opera, Safari, Firefox, OmniWeb, Camino, and Netscape.

Read the related blog entry for more info: Equal height boxes with CSS.

This box has even less content. Anything in it is vertically centered.

Lab Index | 456 Berea Street Home | Copyright © Roger Johansson