5 ways to vertically center with CSS

Kevin Powell on YouTubeWatch on YouTube

SaveMark complete

Sign in to save videos and track what you’ve finished.

BeginnerUI7 min

About this video

Shows five CSS techniques for vertically centering an element: a table cell, absolute positioning, flexbox and grid align-items, and auto top and bottom margins in a flex or grid parent.

What you’ll learn

  • Vertically center an element using a table cell layout
  • Center a child with flexbox or grid align-items
  • Use auto top and bottom margins inside a flex or grid parent