Skip to content

Instantly share code, notes, and snippets.

@TimothyClayton
Last active September 26, 2016 19:33
Show Gist options
  • Save TimothyClayton/259f4d8dc0af7f49601e to your computer and use it in GitHub Desktop.
Save TimothyClayton/259f4d8dc0af7f49601e to your computer and use it in GitHub Desktop.
Easy vertical centering haml/bootstrap3
// Seen lots of solutions but none for haml, and w/o display:flex to support older browsers.
// Utilize the little known whitespace removal syntax...the '<' and '>' below (after class declarations).
.row
.col-md-1.v-center<
= image_tag "ello.png"
.col-md-11.v-center>
%p Hooray! that's what I was going for, and it wasn't hard at all
.v-center {
display:inline-block;
vertical-align:middle;
float:none;
}
.v-center p {
margin:0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment