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.

Vertically Aligning <div> content

Featured Replies

Hi guys,

 

As the title suggests i'm looking to vertically center each of my <div> content.

 

Please see my attachment and it should become clear what i'm after.

 

Here's my code as it stands.

 

http://jsfiddle.net/2Kqnu/

 

I've tried various methods such as vertical-align: middle; margin-top:?? ; margin-bottom:?? ; padding:?? ; but nothing seems to be taking affect for some reason.

 

Thank you once again.

 

 

 

 

 

 

post-12898-0-62274500-1377701044_thumb.png

Display: table and display: table-cell will align content with the middle vertically.

 

Display: table is not the old table code (which should not be used for page structure). Display: table is the modern way to get elements like div to perform like the old table, ie centering vertically so content lines up in every adjacent display: table-cell.

Edited by Wickham

  • Author

Thanks Wickham,

 

I've given that a go, and inserted display: table; in my .item class. Please see the results in my attachment.

 

Perhaps its something else in my CSS (or HTML) thats preventing it to display correctly??

 

http://jsfiddle.net/C9P7D/

 

I also tried display: table-cell; which did not work either.

 

Sorry to be a pain, but I think this is the final issue I have with this particular page, and would really appreciate it if you could look over my code if you have time.

 

Many thanks.

 

 

post-12898-0-13832300-1377766962_thumb.png

  • Author

Thanks Peter,

 

Just tried that as well, no luck unfortunately. I appreciate its the right answer but there must be something elsewhere in my code thats preventing it from happening.

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.