Controlling the Height of HTML Tables that Contain Forms
When working with HTML forms and ASP the order of the tags CAN and WILL make a difference! This article details some traps that HTML newbies can run into when designing ASP pages.
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
<p><font face="Verdana">While trying to create a toolbar using HTML forms in an
ASP page, I created the HTML form within a table using the following code:<br>
<br>
</font></p>
<table border="0" cellPadding="0" cellSpacing="0" width="100%">
<tbody>
<tr>
<td bgColor="#d0d5df" width="100%"><font face="Verdana"><font size="2"><Table
border="0" cellspacing="0" cellpadding="0"
style="HEIGHT: 30px; WIDTH: 100%"><br>
<tr ><br>
<td bgcolor="navy"
width="1%"><br>
</font> <font size="2"></td><br>
<td bgcolor="navy"
width="99%" align="left" valign="center"><br>
<form method="POST" action="<%= strURL%>"
id=form1 name=form1><br>
<input type="submit" value="<%= strEditBtnCaption
%>" name="cmdEdit"><br>
</font> <font size="2">
</form><br>
</td><br>
</tr><br>
</Table></font></font></td>
</tr>
</tbody>
</table>
<p> </p>
<p><font face="Verdana"> The code worked but I ended up with a
blue background that was "taller" than I wanted it to be, as shown in
the screen print below.</font></p>
<p align="center"><font face="Verdana"><img border="0" src="http://www.planet-source-code.com/vb/tutorial/asp/images/FormInsideTable.jpg" width="419" height="307"></font></p>
<p><font face="Verdana"> I tried changing the <TABLE>,
<TR>, and <TD> heights but nothing worked!!!</font></p>
<p><font face="Verdana"> Finally, I decided to move the
<FORM> tags outside of the <TABLE> tags and this is what happened:</font></p>
<table border="0" cellPadding="0" cellSpacing="0" width="100%">
<tbody>
<tr>
<td bgColor="#d0d5df" width="100%"><font face="Verdana"><font size="2"><br>
<form method="POST" action="<%=
strURL%>" id=form1 name=form1><br>
<Table
border="0" cellspacing="0" cellpadding="0"
style="HEIGHT: 30px; WIDTH: 100%"><br>
<tr
><br>
<td bgcolor="navy" width="1%"><br>
</td><br>
<td bgcolor="navy" width="99%"
align="left" valign="center"><br>
<input type="submit" value="<%= strEditBtnCaption
%>" name="cmdEdit"><br>
</font> <font size="2"></td><br>
</tr><br>
</font> <font size="2"></Table><br>
</font> <font size="2"></form></font></font></td>
</tr>
</tbody>
</table>
<p align="center"><font face="Verdana"> It produced
different/better results!!! Now I can control the height of the blue
background to look the way I want it to look!!!<br>
<br>
<br>
<img border="0" src="http://www.planet-source-code.com/vb/tutorial/asp/images/tableInsideForm.jpg" width="419" height="307"></font></p>
Original Comments (3)
Recovered from Wayback Machine