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!

form within table - how to get rid of whitespace?

Status
Not open for further replies.

glideslope

Programmer
Nov 14, 2001
2
ZA
The following code produce whitespace below the image. When the <form> is removed the whitespace disappears. Why?

<html>
<table border=1>
<tr>
<td>
<form>
<img src=&quot;butt0.gif&quot;>
</form>
</td>
</tr>
</table>
</html>
 
<Form> is a block level element thus will create whitespace. You can move the form tags outside the table tag which will move the space outside the table. This may still cause layout problems for you.

Another thing you can do is make the Form an inline element in your stylesheet - form {display:none;}. NS4 will ignore this however.

Hope this is of some use.

Cheers,

Tom
 
Hi,

This is only an IE solution:
<form style=&quot;margin:0px;&quot;>
 
A cheat would be to do the following

<html>
<table border=1>
<form>
<tr>
<td>
<img src=&quot;butt0.gif&quot;>
</td>
</tr>
</form>
</table>
</html>
 
You can do that but it will not pass an HTML validator.
 
Thanks a lot for all the replies! My problem has been solved and the users are smiling again :-D You have made my day! Thanks again!
:-D
 
Here's another tip: Don't do this:
Code:
<td>
<img src=&quot;butt0.gif&quot;>
</td>
Do this:
Code:
<td><img src=&quot;butt0.gif&quot;></td>
The carriage return after the <td> tag and after the <img...> tag are converted to spaces, so you'll end up with a space before and after the image inside the table cell, which can mess things up.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top