From the course: HTML & CSS: Creating Forms

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Select

Select - HTML Tutorial

From the course: HTML & CSS: Creating Forms

Start my 1-month free trial

Select

- [Instructor] In this video we're going to look at how to use the select element to allow users to choose between multiple options. Next, we need to add a fieldset and a legend. And these are used to group the radio buttons together and provide the question that's being answered. If we look on our page here we have the answers, blue, red, and green, but we don't yet see the question. So we're going to add that in the code. So I'm going to go above the first input for the color blue and add fieldset, and then below that legend. Inside the legend element I'm going to ask the question, What is your favorite color? And then after the last of those three options I'm going to close the fieldset and add an additional break tag right there. So when I go back to the browser now I see the question and the answers. So the legend essentially labels the whole fieldset. If someone's using a screen reader it might read to them the legend along with each label. For example it will say what is your…

Contents