From the course: HTML and CSS: Creating Forms
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Select element
From the course: HTML and CSS: Creating Forms
Select element
- [Instructor] In this video, we're going to look at how to use the select element to allow users to choose between multiple options. The select element is what you use when you have multiple options, but don't want to take up very much room on the screen. This is commonly called a dropdown menu. For this example, I'm going to ask someone to choose what toppings they want on their pizza. So I'm going to start with the select element. So select and like an input element, it needs a name and ID, and I'll use the word pizza. So name equals pizza and ID equals pizza. Unlike the input element, the select element needs a closing tag because the options will go inside it. So there's my closing select. So option is a separate element and you can have one or more options. Each option will be nested inside the select element. The content inside the option element is what you'll see on the screen. So here I'm going to do option and then what I want to show on the screen, so let's say pepperoni…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Basic form structure4m 11s
-
(Locked)
Name, id, and label5m 24s
-
(Locked)
Email and URL input types5m 1s
-
(Locked)
Number and tel input types6m 7s
-
(Locked)
Date and time input types4m 34s
-
(Locked)
Radio buttons and checkboxes5m 54s
-
(Locked)
Select element5m 47s
-
(Locked)
Textarea element2m 38s
-
(Locked)
Other input types4m 54s
-
(Locked)
Buttons3m 27s
-
(Locked)
Placeholder attribute2m 54s
-
(Locked)
Other form attributes3m 57s
-
(Locked)
-
-
-
-