Skip to content

Instantly share code, notes, and snippets.

@bittersweetryan
Last active December 25, 2015 19:29
Show Gist options
  • Save bittersweetryan/7027759 to your computer and use it in GitHub Desktop.
Save bittersweetryan/7027759 to your computer and use it in GitHub Desktop.
box-sizing : border-box is not the silver bullet ALL the time.
/* 
Nope! The baseline of our text will be on top of the bottom border.
The 40px line height will extend above the top border causing the text
to be slightly towards to top of the "content" area.
*/
.vcenter-text-inline{
  box-sizing: border-box;
	height: 40px;
	border: 2px solid black;
	line-height: 40px;
	vertical-align: middle;
}

/* 
Still have to do some math, in order to truly center the text we do have
to do make sure line height is height - border, whic will truly give us the 
size of the content area between borders.
*/
.vcenter-text-inline{
  box-sizing: border-box;
  height: 40px;
	border: 2px solid black;
	line-height: 36px;
	vertical-align: middle;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment