Skip to content

Instantly share code, notes, and snippets.

@davidthingsaker
Created January 13, 2014 11:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidthingsaker/8398666 to your computer and use it in GitHub Desktop.
Save davidthingsaker/8398666 to your computer and use it in GitHub Desktop.
To vertically align multiple lines of text including a fix for IE7
.textBox {
position: relative;
height: 100%;
}
.inner {
position: absolute;
display: table;
width: 100%;
height: 100%;
top: 0; left: 0;
.element {
display: table-cell;
vertical-align: middle;
html.ie7 & {
position: absolute;
width: 100%;
top: 50%;
left: 0;
}
span {
display: inline-block;
html.ie7 & {
position: relative;
height: 100%;
top: -50%;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment