Tuesday, August 12, 2014 at 11:55 AM

How to center in CSS

Here's a page that has a bit of text that's centered both horizontally and vertically. You can resize the browser window and it'll move so it stays centered.

If you're interested in why it works, or how it works, here's a page that explains. I've spent years looking for this answer, getting all kinds of confusing advice. This is simple, makes sense, and best of all, it works.

Pro-tip: If you want it off-center, change the percentages in the container style.

Update: This is an example of a page I want this feature for.

Last built: Sun, Mar 22, 2015 at 5:51 PM

By Dave Winer, Tuesday, August 12, 2014 at 11:55 AM. It's even worse than it appears.