HTML & CSS for Beginners Part 20: How to center a div

Kevin Powell on YouTubeWatch on YouTube

SaveMark complete

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

BeginnerUI6 min

About this video

Kevin Powell shows beginners how to center a div in the browser using max-width and automatic margins, a basic layout skill needed before building page layouts. The video is short and aimed at people new to HTML and CSS.

What you’ll learn

  • Center a container horizontally with max-width and auto margins
  • Apply max-width to keep content readable across screen sizes