mamamia
05-26-2007, 11:42 PM
Hi All,
I'm trying to center my image AND the text following it in a box. Here is the CSS:
#box {width: 230px; margin-top: 5px; margin-left: 5px; margin-bottom: 5px; border: 2px solid Black;text-align: center;}
#box img {border: none; vertical-align: text-bottom;}
And here is the HTML:
<div id="box">
<img src="myimage.jpg"/>
This is some text describing this image. And some more stuff here. blah blah.
</div>
If I remove the text following the image, then the image aligns in the center correctly. But as soon as I add that text following the image, the text goes to the right of the image and pushes the image to the left.
I am guessing I can fix this by putting the text in another DIV section. But I would rather avoid that since this setup is already throughout my website, and I'd prefer to fix it just one place using CSS. Any help would be appreciated.
Thanks in advance.
mamamia
I'm trying to center my image AND the text following it in a box. Here is the CSS:
#box {width: 230px; margin-top: 5px; margin-left: 5px; margin-bottom: 5px; border: 2px solid Black;text-align: center;}
#box img {border: none; vertical-align: text-bottom;}
And here is the HTML:
<div id="box">
<img src="myimage.jpg"/>
This is some text describing this image. And some more stuff here. blah blah.
</div>
If I remove the text following the image, then the image aligns in the center correctly. But as soon as I add that text following the image, the text goes to the right of the image and pushes the image to the left.
I am guessing I can fix this by putting the text in another DIV section. But I would rather avoid that since this setup is already throughout my website, and I'd prefer to fix it just one place using CSS. Any help would be appreciated.
Thanks in advance.
mamamia