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.)
![[.]](http://www.onfocus.com/q/posted.gif)
posted at 11:54 AM
I like these solutions
http://www.milov.nl/forum/1/28 for CSS centering.
![[.]](http://www.onfocus.com/q/posted.gif)
posted by
Anil on
1/29/2003 at 3:24 PM
I am unable to read and follow simple instructions.
![[.]](http://www.onfocus.com/q/posted.gif)
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.
![[.]](http://www.onfocus.com/q/posted.gif)
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.
![[.]](http://www.onfocus.com/q/posted.gif)
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!
![[.]](http://www.onfocus.com/q/posted.gif)
posted by
pb on
1/31/2003 at 12:36 PM
[
PGP]
This post is closed to new comments, thanks contributors!