Skip to content

Instantly share code, notes, and snippets.

@ayozebarrera
Created April 16, 2014 08:56
Show Gist options
  • Save ayozebarrera/10836253 to your computer and use it in GitHub Desktop.
Save ayozebarrera/10836253 to your computer and use it in GitHub Desktop.
List vertical align
/*This works because two inline-block elements will vertically align with each other.
The :before rule creates an inline-block element that is the same height as its parent,
which the variable height <span> can vertically align with.*/
ul li span {
display: inline-block;
vertical-align: middle;
}
ul li:before{
content: '';
display: inline-block;
vertical-align: middle;
height: 100%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment