DavetheWave
03-05-2008, 06:27 PM
I am stumped on this one.
I have a DIV that is fixed in height. I am trying to put an image within it that should be vertically aligned to the middle (so space on top and bottom is equal). This was the easiest thing in the world to do in old tables but i can't figure it out in CSS. I can't get it to work, the image just aligns to the very top of the DIV.
Here is the code:
.erabox { height: 67px; width: 318px; display: block; }
.erabox img { vertical-align: middle; }
<div class="erabox"><img src="images/10to19.png" alt="1910 to 1919" width="229" height="38" /></div>
---------------
I know how to make it align vertically using margins on the image. BUT i have to repeat this div up to 20 times, and each time the image inside of it will be different sizes because the graphic will be different.
Help! :confused:
HELP!
I have a DIV that is fixed in height. I am trying to put an image within it that should be vertically aligned to the middle (so space on top and bottom is equal). This was the easiest thing in the world to do in old tables but i can't figure it out in CSS. I can't get it to work, the image just aligns to the very top of the DIV.
Here is the code:
.erabox { height: 67px; width: 318px; display: block; }
.erabox img { vertical-align: middle; }
<div class="erabox"><img src="images/10to19.png" alt="1910 to 1919" width="229" height="38" /></div>
---------------
I know how to make it align vertically using margins on the image. BUT i have to repeat this div up to 20 times, and each time the image inside of it will be different sizes because the graphic will be different.
Help! :confused:
HELP!
