Re: XHTML and form elements

On Thu, Nov 06, 2003 at 10:17:49AM -0500, Emlyn Addison wrote:
| I've had my hand slapped for posting this to the wrong forum:
| 
| 1. Why is XHTML considered invalid if form elements are split between 
| the cells of a table [used for layout purposes]?

They're not. See the valid XHTML 1.1 below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head><title>Example</title></head>
  <body>
    <form action="#" method="get">
      <table>
        <tr>
          <td><label for="myinput">Name:</label></td>
          <td><input id="myinput" name="myinput" /></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><input type="submit" /></td>
        </tr>
      </table>
    </form>
  </body>
</html>

| 2. Why do the <form> and </form> elements include [seemingly useless] 
| vertical spacing if they're invisible?

They don't. The XHTML specs don't specify any spacing around a form,
although browsers are free to implement it. Most would let you override
that using CSS though.

-- 
Toby A Inkster BSc (Hons) ARCS
Contact Me - http://www.goddamn.co.uk/tobyink/?page=132

Received on Thursday, 6 November 2003 18:56:45 UTC