CSS CSS Flexbox Layout Flexbox Properties Vertical and Horizontal Centering

Kevin Dunn
Kevin Dunn
6,623 Points

How to center elements vertically?

So what if I have a flex container and then two elements inside that flex container? How can I align the elements so that they are stacked above each other vertically instead of being side by side horizontally?

Chris Davis
Chris Davis
16,278 Points

You could use

flex-direction: column;

https://jsfiddle.net/j1x5592u/2/

Hope that helps :thumbsup:

1 Answer

Kevin Dunn
Kevin Dunn
6,623 Points

Thanks alot! That worked