Centering of an image within a table...

User 109676 Photo


Registered User
21 posts

Can someone please look at the three (3) images close to the bottome of the below web page and tell me how to change the coding in order to have the images centered within each box from left to right:
http://www.binenbaum.org/Cities_Ukraine … skyy.shtml

The coding that I am using is below:

<td>
<a href="/Images/Akkerman_Synagogue.jpg"><img src="/Images/tn_Akkerman_Synagogue.jpg" width="263" height="162" alt="" border="0" align="center" /></a></td>

Thank you in advance for your help and advice.
In addition to posting your reply to this Forum, can you please send a copy to my e-mail address:

Larry Schenker
Los Angeles, CA, USA
LPSCA@EARTHLINK.NET
User 37670 Photo


Registered User
2,138 posts

Larry wrote:
<td>
<a href="/Images/Akkerman_Synagogue.jpg"><img src="/Images/tn_Akkerman_Synagogue.jpg" width="263" height="162" alt="" border="0" align="center" /></a></td>

Thank you in advance for your help and advice.

Hi. You can control this with a little bit of html code within the <td> section, like this:

<td align="center"> Then your content or image here, then close the tag </td>

You can use align="center", align="left" or align="right" to help position your content inside of the <td>.
You can also use a valign statement and that will align your content vertically. If the images were all different heights, and you wanted all the content be be aligned accross the top of the table, you could use <td valign="top"> this is at the top of the cell</td>. To center vertically, I think you have to use <td valign="middle"> instead of "center", but try both if you need to.

Hope that helps
E-Learning Specialist
www.mainsites.ca is my website, and yes, some of it is crappy.
User 109676 Photo


Registered User
21 posts

Thanks for your help!

I have tried to add the coding that you suggested, but I am not getting it to work correctly.

Exactly where should I add the coding?

ORIGINAL CODING
<tr>
<td>
<a href="/Images/Ukraine_Akkerman_Synagogue.jpg"><img src="/Images/tn_Ukraine_Akkerman_Synagogue.jpg" width="263" height="162" alt="" border="0" align="center" /></a></td>

<td><a href="../../Images/Ukraine_Akkerman_Fortress_2.jpg"><img src="../../Images/tn_Ukraine_Akkerman_Fortress_2.jpg" width="241" height="162" alt="" border="0" align="center" /></a></td>
<td><a href="../../Images/Ukraine_Akkerman_Fortress.bmp"><img src="../../Images/tn_Ukraine_Akkerman_Fortress.jpg" width="192" height="162" alt="" border="0" align="center" /></a></td>
</tr>

TEST 1
<tr>
<td align="center">
<td>
<a href="/Images/Ukraine_Akkerman_Synagogue.jpg"><img src="/Images/tn_Ukraine_Akkerman_Synagogue.jpg" width="263" height="162" alt="" border="0" align="center" /></a></td>

<td><a href="../../Images/Ukraine_Akkerman_Fortress_2.jpg"><img src="../../Images/tn_Ukraine_Akkerman_Fortress_2.jpg" width="241" height="162" alt="" border="0" align="center" /></a></td>
<td><a href="../../Images/Ukraine_Akkerman_Fortress.bmp"><img src="../../Images/tn_Ukraine_Akkerman_Fortress.jpg" width="192" height="162" alt="" border="0" align="center" /></a></td>
</td>
</tr>

TEST 2
<tr>
<td>
<td align="center">
<a href="/Images/Ukraine_Akkerman_Synagogue.jpg"><img src="/Images/tn_Ukraine_Akkerman_Synagogue.jpg" width="263" height="162" alt="" border="0" align="center" /></a></td></td>

<td>
<td align="center">
<a href="../../Images/Ukraine_Akkerman_Fortress_2.jpg"><img src="../../Images/tn_Ukraine_Akkerman_Fortress_2.jpg" width="241" height="162" alt="" border="0" align="center" /></a></td></td>

<td>
<td align="center">
<a href="../../Images/Ukraine_Akkerman_Fortress.bmp"><img src="../../Images/tn_Ukraine_Akkerman_Fortress.jpg" width="192" height="162" alt="" border="0" align="center" /></a></td></td>
</td>
</tr>
In addition to posting your reply to this Forum, can you please send a copy to my e-mail address:

Larry Schenker
Los Angeles, CA, USA
LPSCA@EARTHLINK.NET
User 355448 Photo


Ambassador
3,144 posts

Larry,

Using your original code:
ORIGINAL CODING
<tr>
<td>
<a href="/Images/Ukraine_Akkerman_Synagogue.jpg"><img src="/Images/tn_Ukraine_Akkerman_Synagogue.jpg" width="263" height="162" alt="" border="0" align="center" /></a></td>


Make a simple change to the <td> so that the code now reads:

<tr>
<td align="center">
<a href="/Images/Ukraine_Akkerman_Synagogue.jpg"><img src="/Images/tn_Ukraine_Akkerman_Synagogue.jpg" width="263" height="162" alt="" border="0" align="center" /></a></td>

Just use similar code on all three images. No need to place a td inside another td.
User 109676 Photo


Registered User
21 posts

Billr

It works perfectly.

It is simple once I know what I am doing.

Thanks!
In addition to posting your reply to this Forum, can you please send a copy to my e-mail address:

Larry Schenker
Los Angeles, CA, USA
LPSCA@EARTHLINK.NET

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.