This lesson is exclusive to members

Responsive Web Design Essentials - HTML5 CSS3 Bootstrap

How to you make a drop down form menu for a website in HTML

Daniel Walter Scott

Download Exercise Files Download Completed Files

Contents

Certificates

We’re awarding certificates for this course!

Check out the How to earn your certificate video for instructions on how to earn yours and click the available certificate levels below for more information.

Introduction

I recommend hosting your new website with Bluehost, you can get a big discount by signing up with this link: https://www.bluehost.com/track/byol/byol_webess_77

You need to be a member to view comments.

Join today. Cancel any time.

Sign Up
Hey buddy, this video is going to be about drop-down menus. We're going to pick one, get started with one, it's very exciting. The short version is, basically it's a tag called Select, and you have these option values, and that's what builds your drop-down menu. At the end of this we'll throw in a couple of input types, because we're not going to go through every single one ever created, because, would be very long videos, but we'll quickly look at the Date picker and Color picker, because that's kind of exciting, and get it to work. You go pick a nice color, there you go. Let's work out how to do the drop-down menu, it's not hard. Let's jump in now and work out how to do it. 

I'm going to put it inside my Rapid div, Input wrapper. Made it way too long. Type it in every time. So it is called Select, it's weird. Not drop-down, it's not an input value like most of the rest of them. It's called Select, give it a name and ID, this is like a generic name for the whole thing. Mine's going to be the county that you're in. Different counties in Ireland. And I'm going to use the same name for the ID. Now inside of this are the values for the drop-down menu. These are called Options. Options, give it a value this is what's going to come to you in the email. So the value for this one is going to be Limerick, that's where I'm moving. And the little space here is what the user is going to see. 

We're going to have a couple of them. Jump there, because I was trying to use my shortcut. I got the wrong one. So I'm duplicating the line that I have my cursor selected on, by holding down the 'Shift' and 'Option' key on a Mac, and using the down arrow. On a PC it is 'Shift Alt', and use the down arrow. So I got these two, 'Command D' to get both of them, because I'm going to use the same name, I'm going to put in, go away, I'm just randomly picking in places that our Roar Bikes can go. Probably need one for Dublin as well. County Dublin. Those are all drop downs, let's have a little look, there we go.
 
So very often-- so these are the ones, right? That's cool. Very often though you won't have like the first one prefilled in. You'll have an option here, you can duplicate up as well. We're using the same two shortcuts but using the up arrow, and that's 'Shift Option' on a Mac, 'Ctrl-Shift-Alt' on a PC. I'm going to give this one a value of 'not chosen'. choosen, chosen? 'chosen'. And over here I'm going to use this one as 'choose county'. The reason I've got 'not chosen' is because, that one, because it's the first one it's going to be the default, and if they don't pick anything, it's going to-- well, close it down instead of saving. Let's open it back up, having a good day. Let's preview in the browser, might have to close this. Open it back up again, let's have a little look. 

Can you see, it's the first one, so it's chosen to choose county. And if they leave it on this, I don't want the value coming back of 'choose county'. I want a value, to me, to come back in, of, they didn't pick anything. So nothing selected, or something like that, if I can find it, where are you? You can pre-fill things in, say you want it to start with 'go away', you don't want to use this option here, just kind of have a default one. You can, in here after the quotation marks, just say selected. That can be the one that gets picked first, and they can go and change it from that. Check it out, reset it, it's picked 'go away'. I love 'go away'. All right, drop-down menus. 

Now I could go forever with all the different options. What you can do though is, like there's loads more, I'm just going to quickly skim them. So the ones that I use, whether like a date, real quick. I'm not going to fill in all the data because, some of them don't need much, you just use them without doing anything, but I guess I just want to give you a quick idea of the ones that you're likely to run into. Date one's handy, where is date, time? Let's save it, let's have a little look. So date, time, they can pick a date and time thing, they can pick a color. I'm not sure when they'll be picking a color, and I have no idea whether it's even is, what field is that one? Date, time. Oh, I use date. Don't know what that one is. It must need more values, but there are lots more. 

The best place to go and have a look is, that w3schools place, so w3schools form. So navigating this site in terms of forms, I find I start with clicking this button here, say, "I want stuff about HTML." And then having a look down the side here, there's a bunch of different kind of, like sub groups. In this case, forms, you can start at the top. It kind of gives you general form structure, then it gives you the different elements that go inside of it. Input types, you can see there, and I'll go through and explain them, and how the syntax works. Not in my lovely Kiwi accent, just all written plain text, but we can't go through every single one of them, but you get the idea of most of it, right? Things like names, values, ids are all important. We've worked on labels, I think you have enough now to go off, and be able to kind of implement all these other input types. 

All right, buddy, that is it for forms. We're going to get into styling the forms, because our form is hideous. Look at our form, where is he? That him, that him? they're all the same. Not beautiful, we need to style these and make the form part look a bit nicer. I'll see you in the next video, where we're going to do that.