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!

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

Cory Lawrence
Cory Lawrence
10,222 Points

Label HTML Select Tag

I was just working through the HTML Forms course because I'm building a site that needs select drop-downs. I created a select form that allows the user to select a color. My issue is the label tag puts the label "Color" outside the select tag and displays the first option on the drop-down. I want to display "Color" on the select drop-down and when the user clicks on it, the options come up. Any ideas?

Current: http://rickyalessandro.coryjlawrence.com/product.html Mockup: http://rickyalessandro.coryjlawrence.com/example.html

4 Answers

Alexander Dernild
Alexander Dernild
1,821 Points
<select>
    <option value="" disabled="disabled" selected="selected">Please select a color</option>
    <option value="1">One</option>
    <option value="2">Two</option>
</select>

Try this :)