Okay, so today I came across an issue where I needed to vertically align a block of text on a webpage when the text length can vary drastically meaning padding / line height wouldn’t do the trick.

After trying a few ideas with no success I stumbed across a great way to do it working in the following browsers:

  • Internet Explorer (haven’t tested lower than IE8 yet!)
  • Chrome
  • Firefox
  • Safari
  • Opera

Below is a simple example of how I went about doing this in CSS:



Below is the same CSS as above on a live working demo:

Happy coding and please post up links to any sites you use this on for the benefit of others