I understand where you’re coming from because for some designs the legend isn’t 
easy to style consistently cross-browser, and so sometimes I have used a 
heading instead.  However if possible, using the legend is much better.

 

I also used to wrap form inputs in labels for the same reason as you say – 
styling the form becomes easy – however Mike’s article is very insightful and 
since then I’ve changed what I did and wrap as he suggests.  

 

So I just realised I’m basically echoing Mike’s comments, as that’s what I have 
also discerned as my best practice after quite a bit of form css experience and 
research.

 

J

Rach

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: 16 October 2008 12:35
To: wsg@webstandardsgroup.org
Subject: [WSG] labels as input wrappers + <h6> in place of legend

 

I am looking  for feedback on two questions, based on the simple form snippet 
below.

<fieldset>
   <legend><b>Personal Details</b></legend>
   <label for="name">Name:</label>
   <input id="name" type="text" name="name" size="30"> <br>
   <label for="id">ID Number:</label>
   <input id="id" type="text" name="id number" size="10">
</fieldset>

Question 1:
Is it acceptable, or advisable, to use a header tag <h6> in place of the 
<legend> in order to get cross-browsers consistency when dealing with complex 
form styling?  How much impact might this have on accessibility, if any?

Question 2:
I don't see many folks using the <label> as a wrapper to contain the input.  
Any reason not to do this?  It allows for the <br /> to be removed via display: 
block; on the <label> tag as well as allowing users (of most browsers) to click 
on a much larger label to select the accompanying input.

 <fieldset>
   <h6>Personal Details</h6>
   <label for="name">Name:
   <input id="name" type="text" name="name" size="30">
   </label>
   <label for="id">ID Number:
   <input id="id" type="text" name="id number" size="10">
   </label>
</fieldset>


*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
******************************************************************* 


*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to