Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to make your auto heights equal

Featured Replies

If you've ever tried to create an image gallery with captions, a product catalog or other floating block elements with automatic heights it's likely you have been tempted to use tables or create unsemantic surrounding divs. But now those days are over. I've created a cross browser solution that supports responsive design using lightweight raw JavaScript. Say goodbye to tables and css hacks and hello to JavaScript.

 

 

Source Code here: http://www.nielsharbo.dk/videotuts/alignheights.zip

 

Suggestions for improvement and other relevant comments are more than welcome.

  • Author

Thanks for your comments Jack and Teodora...

 

This looks cool. Shove it on Github though :)

 

I havn't considdered submitting the code to Github as the code is more like a tutorial example than an actual script. But maybe I should as I havn't seen any similar code anywhere.

If you've ever tried to create an image gallery with captions, a product catalog or other floating block elements with automatic heights it's likely you have been tempted to use tables or create unsemantic surrounding divs. But now those days are over. I've created a cross browser solution that supports responsive design using lightweight raw JavaScript. Say goodbye to tables and css hacks and hello to JavaScript.

 

 

Suggestions for improvement and other relevant comments are more than welcome.

Display:table used in any element, like a div, can be useful to line up items with different heights, but remember that older browsers don't process display: table but these have a very small proportion of browser useage now.

 

Display:table is not the same as old-fashioned tables; it's the modern equivalent that has the same effect but far more options and is suitable for page structure when used with divs or other elements.

Edited by Wickham

  • Author

Display:table used in any element, like a div, can be useful to line up items with different heights, but remember that older browsers don't process display: table but these have a very small proportion of browser useage now.

 

Display:table is not the same as old-fashioned tables; it's the modern equivalent that has the same effect but far more options and is suitable for page structure when used with divs or other elements.

Indeed display:table/row/cell can be used.

The cool thing about the JavaScript solution is that it works great with responsive designs even without mediaqueries or extra wrappers as you can have the "boxes" floating

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.