Forum Moderators: open

Message Too Old, No Replies

Annoyance with table and form

         

bysonary

12:58 am on May 14, 2007 (gmt 0)

10+ Year Member



Hello, i'll start with the HTML i have

<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="100%" class="bottomborder whiteback topbar valigntop">
<form name="search" action="searchglob.php" method="post"><input name="searchfor" type="text" class="formtxt" value="Search">
<input type="image" src="skin/search.png" value="Submit" alt="Search"></form>
</td>
</tr>
</table>

Basically the table looks fine when i code it in dreamweaver and preview it in there, but when I move to the browsers it looks different. There is a massive gap below the form <input type="texT">

I want the bottom of the table to be as flush as possible with the bottom of the form text input. Can anyone suggest anything?

I would appreciate it.

Thanks.

Marshall

2:07 am on May 14, 2007 (gmt 0)

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



While not proper html, you could put the <form> and </form> tags outside the <table> and </table> tags

cmarshall

2:16 am on May 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Make sure you have decent DOCTYPE. That will help.

This seems to work for me:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>
Untitled
</title>
</head>
<body>
<div id="wrapper">
<table border="1" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="100%" class="bottomborder whiteback topbar valigntop"><form name="search" action="searchglob.php" method="post">
<input name="searchfor" type="text" class="formtxt" value="Search">
<input type="image" src="skin/search.png" value="Submit" alt="Search">
</form></td>
</tr>
</table>
</div>
</body>
</html>

tedster

4:35 am on May 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



While not proper html, you could put the <form> and </form> tags outside the <table> and </table> tags

Nothing invalid about that. Just be sure to open the form element before the table starts and close it after the form element closes and you're valid. Or you can place the form element completely inside the table cell (<td>) and you're also valid.

Validation trouble comes from improper nesting, or from having the form element between a <tr> and a <td>

[edited by: tedster at 7:21 am (utc) on May 14, 2007]

SuzyUK

6:34 am on May 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



you can leave the form inside the TD - then try zeroing the default margins on the form..

td.topbar form {margin: 0;}

Xapti

9:54 pm on May 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To get a proper solution to your request, it is necessary that you give us your CSS code, or at least the style definitions for the following classes: bottomborder, whiteback, topbar, valigntop, and formtext

When you say "There is a massive gap below the form <input type="texT">" you mean below the form'S input, and above the submit, or what? because it's not clear.
Lastly, when you say massive... how big is it approximately?

Not sure if this works, but you can try a universal reset (*{padding:0;border:0;margin:0} on either everything (and then manually give padding/margins tho the things you want padding/margins on), or specifically set all tds, trs,table, form, input, or whatever elements are causing you trouble to 0 padding, 0 margin.

Lastly... may I ask why you are using a 1-celled table? Why aren't you using a div or something?