phases
sun
paul bausch onfocus
Navigate
You're currently reading a single post from the archives. To read the most recent posts, visit the onfocus home page.
Wednesday - January 29th, 2003

CSS Centering

Someone just sent a screenshot of the gallery below on a Mac (thanks Dave!), and it wasn't displaying properly. The latest version of snapGallery has an all-CSS layout, and it appears there's some problems with the technique I'm using to center everything on the page. Do any CSS experts out there know a cross-platform way to center information on a page both horizontally and vertically using only CSS? (no tables.)
[.] posted at 11:54 AM

Comments
I like these solutions http://www.milov.nl/forum/1/28 for CSS centering.
[.] posted by Anil on 1/29/2003 at 3:24 PM
I am unable to read and follow simple instructions.
[.] posted by Anil on 1/29/2003 at 3:24 PM
No problem, that's why comments systems have erasers, er, editing features. That's the technique I'm using to center images. Apparently it doesn't work in some Mac browsers. The thread does allude to a !DOCTYPE problem on the Mac, though. I wish I had one to test on.
[.] posted by pb on 1/29/2003 at 3:34 PM
For what it's worth, the negative margins are apparently causing the screw-up in Safari. I have almost never had success with negative values in CSS.

I did try dropping the margins, and that at least got the image on the visible page. But now it's ignoring the top value... which might be a browser bug.

CSS is just about the funnest thing ever.
[.] posted by Paul on 1/31/2003 at 5:57 AM
As far as I know, using negative values is the only way to vertically center something on a page. Yep, CSS is a blast. It's supposed to be *better* than HTML for stuff like this!
[.] posted by pb on 1/31/2003 at 12:36 PM [PGP]
Commenting Is Closed
This post is closed to new comments, thanks contributors!