I'm using two divs to create a shadowed-box type effect. Within the top div I want to put an image. I can get the image to center right to left, but not top to bottom. I'm making a series of boxes, and the images in them aren't all the same size. So I've sized the boxes to mach the largest of them, and I want to center them, so those that are smaller will be in the middle of the first div.
Here's the code on the page:
<table border="0" cellpadding="23 " cellspacing="0" bordercolor="#F F33FF" width="900" bgcolor="#c4c4c 4">
<tr>
<td align="center" valign="middle" >
<div id="shadowdiv" align="center">
<div id="imagediv" align="center" style="height: 187px;"><img src="/images/manna2.gif" alt="" /></div>
</div>
</td>
<td align="center" valign="middle" >
<div id="shadowdiv" align="center">
<div id="imagediv" style="height: 187px;"><img src="/images/fit2.gif" alt="" /></div>
</div>
</td>
</tr>
<tr>
<td align="center" valign="middle" >
<div id="shadowdiv" align="center" >
<div id="imagediv" style="height: 187px;"><img src="/images/3dlogo2.gif" alt="" /></div>
</div>
</td>
<td align="center" valign="middle" >
<div id="shadowdiv" align="center">
<div id="imagediv" style="height: 187px;" align="center"> <img src="/images/smallgroups2.gi f" alt="" /></div>
</div>
</td>
</tr>
<tr>
<td align="center" valign="middle" >
<div id="shadowdiv" >
<div id="imagediv" style="height: 386px;"><img src="/images/christmasshow2. gif" alt="" /></div>
</div>
</td>
<td align="center" valign="middle" >
<div id="shadowdiv" >
<div id="imagediv" style="height: 386px;"><img src="/images/servicetimes2.g if" alt="" /></div>
</div>
</td>
</tr>
</table>
Here's the css regarding the two divs:
#shadowdiv {
width: 360px;
padding: 5px;
filter: shadow(color:re d, strength:6, direction:135);
vertical-align: middle;
text-align: center;
}
#imagediv {
width: 350px;
text-align: center;
padding: 0px;
background-image: url(/images/marb009.jpg);
border: 1px solid black;
font-size: 12px;
vertical-align: center;
}
As I play with the text-align property it moves the image horizontally, the vertical-align property seems to have no effect on the image placement though. I'm making the page in IE.
I'm thinking if nothing else I could try putting a table in the div, then put the image in the table, and center it that way... but if there's a way to do it with just the divs, that'd be preferable.
Here's the code on the page:
<table border="0" cellpadding="23 " cellspacing="0" bordercolor="#F F33FF" width="900" bgcolor="#c4c4c 4">
<tr>
<td align="center" valign="middle" >
<div id="shadowdiv" align="center">
<div id="imagediv" align="center" style="height: 187px;"><img src="/images/manna2.gif" alt="" /></div>
</div>
</td>
<td align="center" valign="middle" >
<div id="shadowdiv" align="center">
<div id="imagediv" style="height: 187px;"><img src="/images/fit2.gif" alt="" /></div>
</div>
</td>
</tr>
<tr>
<td align="center" valign="middle" >
<div id="shadowdiv" align="center" >
<div id="imagediv" style="height: 187px;"><img src="/images/3dlogo2.gif" alt="" /></div>
</div>
</td>
<td align="center" valign="middle" >
<div id="shadowdiv" align="center">
<div id="imagediv" style="height: 187px;" align="center"> <img src="/images/smallgroups2.gi f" alt="" /></div>
</div>
</td>
</tr>
<tr>
<td align="center" valign="middle" >
<div id="shadowdiv" >
<div id="imagediv" style="height: 386px;"><img src="/images/christmasshow2. gif" alt="" /></div>
</div>
</td>
<td align="center" valign="middle" >
<div id="shadowdiv" >
<div id="imagediv" style="height: 386px;"><img src="/images/servicetimes2.g if" alt="" /></div>
</div>
</td>
</tr>
</table>
Here's the css regarding the two divs:
#shadowdiv {
width: 360px;
padding: 5px;
filter: shadow(color:re d, strength:6, direction:135);
vertical-align: middle;
text-align: center;
}
#imagediv {
width: 350px;
text-align: center;
padding: 0px;
background-image: url(/images/marb009.jpg);
border: 1px solid black;
font-size: 12px;
vertical-align: center;
}
As I play with the text-align property it moves the image horizontally, the vertical-align property seems to have no effect on the image placement though. I'm making the page in IE.
I'm thinking if nothing else I could try putting a table in the div, then put the image in the table, and center it that way... but if there's a way to do it with just the divs, that'd be preferable.
Comment