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