Forum Moderators: open

Message Too Old, No Replies

Center aligning image in table cell

What's the problem here?

         

Nick_W

12:06 pm on Nov 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My client uses ie5x on a Mac and says the img in this code is left aligned How can this be? I don't think I can make it any clearer....

<td height="300" width="400" align="center">
<div align="center"><img src="img.gif" alt="" />
</div>
</td>

Anyone have any suggestions as to how to fix this?

Thanks...

Nick

idiotgirl

12:33 pm on Nov 7, 2002 (gmt 0)

10+ Year Member Top Contributors Of The Month



Since you've already declared your table cell as having a center alignment, why are you using a div inside the cell? Have you tried using one or the other instead of both? Or just using
align="center"
within your image tag itself? I'm wondering if another div set or declaration on the page (css) is taking precedence.

I'd whack it down to its simplest element, even test on another page (no external css - no additional divs) to pinpoint the problem. When you start adding things back in - when it "blows up" you'll know what did it.

Nick_W

12:39 pm on Nov 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



why are you using a div inside the cell?

I started with just the td but I'm at my wits end and have been trying everything...

Good point about CSS, I'll check it out...

Nick

gsx

3:41 pm on Nov 7, 2002 (gmt 0)

10+ Year Member



Hmmmm, this is where people state that you should use "align='center'" in your html instead of <center></center>.

Try the latter in place of your divs and align values, it always used to word for me (and still does).

And CSS should be over-ridden by any commands to the contrary in the html file, so it is probably not a CSS problem, but worth checking for the 30seconds it takes.

Syren_Song

7:50 pm on Nov 7, 2002 (gmt 0)

10+ Year Member



With the understanding that the problem may have already been fixed by now, check to make sure you don't have any align codes in your row tag either.

If you get rid of all the alignment tags from div, cell, and row, you should be able to fix your problem with a simple align="center" in your image tag.

Nick_W

6:56 am on Nov 8, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks everyone, I found the problem!

Turns out to be a bug in some older versions of IE for Mac.

I had td img { display: block; } in my stylesheet and it didn't like it. Weird....

Thanks all...

Nick