Click here to get back home

easy form layout question

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
easy form layout question mouac01 02-10-2006
Get Chitika Premium
Posted by mouac01 on February 10, 2006, 4:28 pm
Please log in for more thread options


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..


Posted by Jukka K. Korpela on February 11, 2006, 8:34 am
Please log in for more thread options


mouac01@yahoo.com wrote:

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

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.

> <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

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">
<table>
<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>
</table>
</form>

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

Similar ThreadsPosted
(hopefully) very easy question concerning forms January 14, 2008, 6:03 pm
DIV layout question February 11, 2006, 2:30 pm
Form layout problem December 26, 2007, 6:49 pm
Form-Tag influences table layout December 18, 2006, 12:23 pm
tables for layout bugs question November 1, 2006, 9:33 am
Layout question: padding within line box. January 11, 2007, 5:16 pm
Is my site/web app easy to use? November 1, 2007, 5:16 pm
HTML email the easy way October 16, 2004, 12:41 pm
Make Money Fast and Easy!!! October 21, 2007, 7:59 pm
Detecting Intruders on Your System Is Fun and Easy December 11, 2007, 8:52 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap