CSS Tip: How To Vertical Align One Div Inside Another

Here is the handy CSS code you can use to vertically align one div inside a parent div:

.parentDiv {
	display: inline-flex; 

.childDiv {
	margin: auto 0px;

I found this code on this StackOverflow answer.

Meet the author

Libby Fisher is an experienced freelance web developer, recently relocated from Seattle to Boston, and passionate about developing websites that are both aesthetically appealing and intuitively usable - or as she prefers: "beautifully effective."