easy form layout question

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

How do I get a label to be on top of a text field?

<label>Login:<input type="text" name="login"></label>
<label>Password:<input type="password" name="password"></label>

generates this...

Login:textbox Password:textbox

I want...

Login:      Password:
textbox     textbox

Thanks...  CM..

Re: easy form layout question

mouac01@yahoo.com wrote:

Quoted text here. Click to load it

Layout is basically a matter of CSS, not HTML. This is c.i.w.a.html, not
c.i.w.a.stylesheets. Admittedly, you _could_ do some simple layout in
HTML, and, somewhat debatably, this is also about structure.

Quoted text here. Click to load it

That would break users' expectations. That's not the way things are
commonly presented. Besides, it would confuse people who use simple
speech-based user agents that read line by line and ignore <label> markup.

What you _should_ want is

Login:    textbox
Password: textbox

and a way to achieve this is

<form action="..." method="post">
<tr><td><label for="username">Login</label>:</td>
     <td><input id="username" type="text" name="login"></td></tr>
<tr><td><label for="pwd">Password</label>:</td>
     <td><input id="pwd" type="text" name="password"></td></tr>

If you really want the layout you describe, the table approach can be
used with obvious modifications.

Site Timeline