Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tables

Status
Not open for further replies.

z35

Programmer
Dec 21, 2001
206
US
Hi,

I have created a table with 3 columns and three rows. - 9 boxes.

Each box is 125 pixels wide by 100 pixels in height. and the table has a white border.

Some boxes will hold thumbnail photos and some will be empty.

My problem is that the photo is not snug in the box with a neat white border around it.

It is snug on 3 sides and on the bottom, there is some blank space and it looks sloppy.

Does anyone know how I can fix this grid?
 
Sure....


<table width=&quot;375&quot; border=&quot;2&quot; bordercolor=&quot;#ffffff&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>

<tr height=&quot;100&quot;>
<td width=&quot;125&quot;><img src=&quot;MVC-325X.jpg&quot; width=&quot;125&quot; height=&quot;100&quot;>
</td>
<td width=&quot;125&quot;>photo
</td>
<td width=&quot;125&quot;>photo
</td>
</tr>

<tr height=&quot;100&quot;>
<td width=&quot;125&quot;>photo
</td>
<td width=&quot;125&quot;>photo
</td>
<td width=&quot;125&quot;>photo
</td>
</tr>

<tr height=&quot;100&quot;>
<td width=&quot;125&quot;>photo
</td>
<td width=&quot;125&quot;>photo
</td>
<td width=&quot;125&quot;>photo
</td>
</tr>

</table>
 
Do you know what worked for me?? (in IE6)

I eliminated any spaces in the cells code

<table width=&quot;375&quot; border=&quot;2&quot; bordercolor=&quot;#ffffff&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<tr>
<td width=&quot;125&quot; height=&quot;100&quot;><img src=&quot;MVC-325X.jpg&quot; width=&quot;125&quot; height=&quot;100&quot;></td>
<td width=&quot;125&quot;><img src=&quot;MVC-325X.jpg&quot; width=&quot;125&quot; height=&quot;100&quot;></td>
<td width=&quot;125&quot;><img src=&quot;MVC-325X.jpg&quot; width=&quot;125&quot; height=&quot;100&quot;></td>
</tr>

...etc


This is probably not the correct solution but see if it works for you.


É
<!--#include file=&quot;profound quotation&quot; -->
 
Hi,
yes this works for me, for now. thanks for the help. I'm worried this might still look messed up in certain browsers, maybe old ones...

I noticed in Netscape, the bordercolor for the table is not showing.

IE understands bordercolor=&quot;white.&quot; Do you know if it is it something different for Netscape??
 
cian's solution is the correct one for the spacing problem around images. It's a very old problem - goes back to when tables were first implemented in html. I remember reading a caution about it way back when. The problem is that any runs of whitespace (spaces, tabs and newlines) in html are compressed to single spaces. That means when you have a line break before or after an image tag that line break is actually being turned into a SPACE, which is what's causing the spacing around the image in the cell. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Thanks for the explanation Tracy, i thought it might be something like that, its a common problem if I use a 1px width table cell as a &quot;line&quot; by adding a background colour to the cell, always messes up when I &quot;beautify&quot; my code.


É
<!--#include file=&quot;profound quotation&quot; -->
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top