Need some CSS Help

shikhan

Senior member
Mar 15, 2001
834
0
71
Hi guys,
I've decided to update my site to use only CSS. I've managed to get most of it the way I want, but I'm having problems with the gallery portion of my site. Namely, I'm having troubles getting the images to center in their respective boxes. I finally figured out that using the vertical-align:middle on the img tags and seting the line height on the div tag containing the image works in Firefox, but I still haven't figured out a solution for IE, and my searches have come up empty. Can any one help shed some light on this?

My site is http://www.shikhan.net (and an example of a galery which shows the problem is http://www.shikhan.net/gallery.php?gid=26).

I'm also open to any suggestions on the site. ^_^
 

shikhan

Senior member
Mar 15, 2001
834
0
71
Originally posted by: screw3d
http://www.jakpsatweb.cz/css/css-vertical-center-solution.html

That should give you some clues.. although the page is mainly about centering it in the browser, not individual elements in a div.

Thanks screw3d! With a little tweaking, that worked great (for the 2 browsers that I'm testing, at least).

notfred, the link you provided requires to know the height of the object, which I can't know in the css since I'm displaying pictures. Thanks for the link, though.
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
Originally posted by: shikhan
Originally posted by: screw3d
http://www.jakpsatweb.cz/css/css-vertical-center-solution.html

That should give you some clues.. although the page is mainly about centering it in the browser, not individual elements in a div.

Thanks screw3d! With a little tweaking, that worked great (for the 2 browsers that I'm testing, at least).

notfred, the link you provided requires to know the height of the object, which I can't know in the css since I'm displaying pictures. Thanks for the link, though.

Sure you can know the height of the pictures, just change your PHP script to insert it into the page.
 

shikhan

Senior member
Mar 15, 2001
834
0
71
Yea, I know that. But I was trying to avoid having my php get each images dimensions and insert a style tag into each div.:eek:
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
Well if you do change the PHP tag, don't add a style tag to each div, add "width" and "height" attributes to each <img> tag.