Re: HTML forms

This is quite simple. There is no reason to ever use "hacks" or the  
<br> tag. Also note that <form> is already block level.

label input {
	display: block;
}

<form action="">
	<div>
		<label>Name: <input name="name" type="input"></label>
		<label>Surname: <input name="name" type="input"></label>
	</div>
</form>

- Elliott

On May 2, 2007, at 6:06 PM, Schalk Neethling wrote:

>
> Greetings everyone,
>
> I have noticed a lot of discussion about the different form  
> implementations that are being proposed and I am sure they all have  
> their merit and place however, after discussing some of the aspects  
> of coding forms in HTML with a colleague I can surely all agree  
> that this is one of the areas we all love to to hate. The ways we  
> currently have to go about making forms look functional an usable  
> is just not the way we want it to be.
>
> We have to do all kinds of hacks and none of these are semantic  
> solutions to get forms to display the way we want them to. I here  
> propose a simple solution. The majority of users actually prefer  
> having forms laid out as follows:
>
> name:
> [  form element ]
> surname:
> [ form element]
>
> This makes connecting the label to the appropriate field very easy  
> on the eye as well as a host of other benefits like being able to  
> add validation errors to the <label> tag without affecting layout 
> (in general):
> name:
> [ name]
> surname: !you must provide a surname!
> [ form element ]
>
> So what do I propose? Make the <label> and form element tags block  
> level elements so that form elements by default break to the next  
> line instead of having to use the current hacks or using the <br />  
> tag to break to the next line.
>
> I believe this will make default form layout a lot more effective  
> and semantic while still allowing alternate layout of forms using CSS.
>
> Look forward to your feedback.
>
> -- 
> Kind Regards
> Schalk Neethling
> CO-President
> The South African Web Standards and Accessibility Group
>

Received on Wednesday, 2 May 2007 22:48:17 UTC