Re: Form elements

On May 25, 2007, at 3:10 PM, Schalk Neethling wrote:

>
> Hey All,
>
> Myself and a colleague have done some tests regarding forms. Form  
> in general are HELL for developers and designers. Why can we not  
> ensure that all form elements that are not already block level be  
> block level. The majority of web users prefer to have forms laid out:
>
> label
> form element
>
> label
> form element
>
> I know this can be done easily with CSS but, when users access a  
> site and do not have CSS available forms get very messed up. I  
> believe each form element should be block level by default.

1) What elements are "block level" vs. "inline level" in the HTML  
spec is actually unrelated to CSS block and inline display. Making an  
element "block level" for spec purposes will not change how it renders.

2) Changing the default rendering for form elements would not be  
acceptable. It would break massive amounts of deployed form content.


> We should not have to use <br> to ensure our forms display  
> correctly for all.
>
> Anyone else have any thoughts on this? Some form elements are block  
> level by default,

In HTML4, as far as I can tell, all form controls are "inline-level"  
per the DTD, and in CSS they all default to rendering as inline, not  
block (technically they are replaced elements but they can be part of  
an inline flow).

Here is a quote from the HTML4 DTD:

<!ENTITY % formctrl "INPUT | SELECT | TEXTAREA | LABEL | BUTTON">
<!ENTITY % inline "#PCDATA | %fontstyle; | %phrase; | %special; | % 
formctrl;">

I believe HTML5 has the equivalent treatment for these elements,  
although it lacks a DTD.

> why not make all of them block level by default?

A lot of sites have forms with the label to the left or to the right  
of the form element, although some have it above. For checkboxes and  
radio buttons, the label  always placed to the right. I think we need  
to make sure both styles of rendering are supported well. Even  
without the compatibility constraints, it is often simpler for  
authors to add a line break than to remove one.

Regards,
Maciej

Received on Friday, 25 May 2007 22:36:41 UTC