Forum Moderators: open

Message Too Old, No Replies

How do I get rid of the gaps in this table please

         

midi25

10:07 pm on Jun 10, 2003 (gmt 0)

10+ Year Member



Hi I have created a table and I am getting white space gaps between my rows as my images are black. How can i tighten up the rows and eliminate the white gaps.

Thanks

<table><tr><td><img src="i/aboutbt.jpg"></td></tr>
<tr><td><img src="i/designbt.jpg"></td></tr>
<tr><td><img src="i/hostingbt.jpg"></td></tr>
<tr><td><img src="i/contactbt.jpg"></td></tr>
</table>

waldemar

10:10 pm on Jun 10, 2003 (gmt 0)

10+ Year Member



<table border="0" cellpadding="0" cellspacing="0" >

pageoneresults

10:11 pm on Jun 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Is that the exact code? As it is displayed in the html of the page? If you have hanging </td> tags, that would cause a problem.

<img src="i/contactbt.jpg">
</td> (This td is hanging.)
</tr>

Also, I'll assume there are no cellpadding or cellspacing attributes assigned to the table?

drbrain

10:15 pm on Jun 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You're using a standards-mode doctype aren't you?

You can add the following CSS:

td img { vertical-align: bottom }

or:

td img { display: block }

Images, Tables, and Mysterious Gaps [devedge.netscape.com] on Netscape Devedge has an article about it.

midi25

10:16 pm on Jun 10, 2003 (gmt 0)

10+ Year Member



Thanks waldemars solution sorted it lol. Why dont I ever bother to learn the things that catch me out all the time.

waldemar

10:28 pm on Jun 10, 2003 (gmt 0)

10+ Year Member



You're welcome :-). (Don't bother to learn pixel positioning via tables though. Instead give CSS a try.)

grahamstewart

10:31 pm on Jun 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



CSS solution:

table {
border-collapse:collapse;
}
td {
border:none;
margin:0;
padding:0;
}

Advantage: sorts out all your tables in one go rather than specifying <table border="0" cellpadding="0" cellspacing="0" > for each of them.

Note the nice symmetry with the HTML solution..
border="0" -> border:none;
cellpadding="0" -> padding:0;
cellspacing="0" -> margin:0;