Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML HTML Forms Organizing Forms The Label Element

Michael Bran
Michael Bran
1,687 Points

Is there any reason why simply using an h tag to do this wouldnt work just as well? <h3>Name:</h3>

Just wondering if there is some reason to use label over h3 (or any H)? What are the advantages or disadvantages to different approaches?

Edit: I understand you can "click" the label, but if you have to click, you might as well click the form box itself since thats where you have to type. I've never clicked labels in 20+ years of using computers, only ever in the box. Is this normal user behavior? Plus there must be a way to auto-focus the cursor which would be the most user friendly for devices without a mouse, though I have no clue how that would be done.

2 Answers

Kevin Gates
Kevin Gates
15,052 Points

Accessibility. Labels are used in conjunction with inputs and therefore provide onscreen assistance for those who need it. Headers are more like brief summaries of the next section of content.

Gabriel Plackey
Gabriel Plackey
11,064 Points

I think one of the main draws of labels over headers is that you can attach or group a label with an input using the for attribute, vs having to do more work than you need to do to group them together.