Lately I have been using the W3C validator (http://validator.w3.org/) to check the validity of my pages. Aside from the obvious benefit of conformance to the W3C Recommendations I'm learning new things about how HTML needs to be written and how it's different from what I thought should be.
Specifically to this example I was always sure that the correct way to combine a form with a table was :
This always worked for me and I never saw any problem using forms this way With IE nor FireFox so I was sure I was OK. When I started to check my site The validator indicated the following error : document type does not allow element "FORM" here.
So I started playing with the location of the FORM tag and found out that the HTML should really look like this :
This HTML is valid HTML 4.01 Transitional code but this is also where my problem started. As soon as I took the FORM tag out of the area between the <TABLE> and the <TR> IE added an empty line
bellow the form which defaced the way the page looked. The big surprise was that FireFox ignored this and showed the page OK. It's usually FireFox that does not allow to make HTML mistakes.
To make a long story short, what needs to be done is this :
<FORM ACTION="" STYLE="DISPLAY:INLINE;">
Adding the "DISPLAY:INLINE" STYLE solves the extra line in the HTML.
In the newer browsers you can also try this instead :