Hacker News new | past | comments | ask | show | jobs | submit login

Yeah, label is great.

You can associate a label with any element without having to nest the element in the label too; just use label's for attribute with the element's ID. It's useful, for example, if you want the labels in one column and the form controls in another.

Make sure to have the label take the maximum available space; if you have a label centered in a table cell you want the label to span the whole cell so it's easier to click on it to select the associated control.




Once I started using <label> for all my forms, I became quite keenly aware of others' forms which don't use it. It's extremely convenient.

edit: http://htmldog.com/ has great tutorials on modern and complete form building. It's a fantastic resource.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: