Web Hosting Talk







View Full Version : HTML <form> tag always does a break


Goldfiles
10-15-2006, 07:52 PM
I have a standard <form blah blah> </form> tag, but it always breaks (<br />) after it. This is throwing off my design quite a bit. Is there anyway to do a <form> tag so it doesn't do a <br /> afterwards?

Thx

mwatkins
10-15-2006, 08:03 PM
Surely you don't actually mean that there's a BR element being inserted after your form, right? Are you just refering to the placement of whatever element (lets assume a P following) having space above? Use CSS.

Assuming your next element is a P...

form + p {margin-top:0;}

Goldfiles
10-15-2006, 08:07 PM
Well, here is what it looks like:

<th align="center" scope="col" width="33%" height="34">
<form method="post" action="rating.php">
<select name="rating">
<option>100%</option>
<option>95%</option>
<option>90%</option>
<option>85%</option>
<option>80%</option>
<option>75%</option>
<option>70%</option>
<option>65%</option>
<option>60%</option>
<option>55%</option>
<option>50%</option>
<option>45%</option>
<option>40%</option>
<option>35%</option>
<option>30%</option>
<option>25%</option>
<option>20%</option>
<option>15%</option>
<option>10%</option>
<option>5%</option>
<option>0%</option>
</select>
<input type="submit" name="Search3" value="Rate" />
</form>
</th>

How can I clean this up with CSS so it doesn't print a line break after the </form> close?

mwatkins
10-15-2006, 08:37 PM
Here's an example:
<html>
<style type="text/css">
form#rating {margin-bottom:0;}
</style>
<body>
<table>
<tr>
<th align="center" scope="col" width="33%">
<form id="rating" method="post" action="rating.php">
<select name="rating">
<option>100%</option>
<option>95%</option>
<!-- snip -->
<option>5%</option>
<option>0%</option>
</select>
<input type="submit" name="Search3" value="Rate" />
</form>
</th>
</tr>
<tr><td>Hoo Ha</td></tr>
</table>
</body>
</html>

Your mileage may vary. If you run into inconsistencies among browsers, ecommend using a valid DOCTYPE.

Goldfiles
10-15-2006, 08:57 PM
Thanks mwatkins! That worked great!