Adding Our Dropdown to the Website
Hello. Good looking Web designer. We are going to basically take the techniques from the last video instead of doing it in an isolation, we're gonna do it to our own site. Okay. We're gonna drop down menu and kind of integrating into an existing site. And it's going to help reinforce what we've learned but also pick up a couple of quirks that happens when you're kind of you're working in a bigger example. Alright. Let's jump in and work out how to get it going. Alright. So we've closed down the last project. Let's open up index and we kind of reset everything because sometimes it's good to just remember how it all gets going. So open up index. You can double click to open up a second file. So double click them both, they open up separately, then stars dot CSS this tab, drag it over here. The html. I like to turn my rapping back on, sort of wraps around. And I'm going to drag you over there. Alright. We said okay. So we're gonna do it again, but we're gonna show you some shortcuts as we...
ll. Because what we did is we created a nav and then we created just a tags with these classes on. But remember in the last video we can't just use the a tags, we need to wrap them up in a div tag. Okay. To wrap things, you can just start typing it in here and you can say actually I want to put Devyn here, called we call it NEV button. Okay. That would work. Okay. But then the device is there and I can cut it and I can put it after my A there and you can kind of see that the slow process there. So you ready for a shortcut game. So what we do is you highlight this fella. Okay. We're gonna wrap around selection so I'll show you the long way you go to view and go to command palette. We've used him before. Once this guy does everything, it's like the do it all. Okay. What we're looking for is there should be this, is it greater than symbol there? Okay. Well the closing square brackets and in here is a bunch of stuff mine's got recently used. That's the one I want to wrap with abbreviation. Okay, that's the one I want but you won't have that there. You start typing rap. Okay. And it cuts it down to the things you can do that. Have the word wrapping it and we want this on with abbreviation. Okay, I'll show you the long way now. This is the abbreviation. Now think abbreviation is I want to what do we want to name this tag And I'd like to wrap it up in a div tag called nav button. You're gonna see what it's doing down there. Look how handsome that is, enter to confirm. Done. Nice. Huh? Okay. So it's just a real handy thing. Let's look at doing it one more time with a slightly with a little bit of extra shortcuts highlighted. Okay then on my Mac. I go command shift P. I'm assuming on a Pc. It's control shift P. If you're not sure, go to slick view. It's whatever shortcut is there on your Pc. Okay, so I'll go back let's try and get the flow going down. Alright. So I wrapped it up feeling good. Command shift P. And then I go because it's already there. I don't have to do anything. You could type trap. Okay. I'm making this slow but I can just hit return on my keyboard and then go all right, I want to wrap this up in Nav button. Okay, Nav button smoothed in. He totally destroyed that I wasn't watching. Alright. Ready for the flow. Alright, flowing, highlighting it, commands your P wrap with abbreviation. Put in NEV but in had returned ah look at that, that was better highlight this guy, command shift P. Return. And let's put in a dot. Let's put a knob button and we're doing some cool wrapping and you can see it indented it, see when I talk slowly. Did that help for anybody? Maybe not. Alright, so I'm separating it out just to kind of be very clear what we're doing. So we've got our three buttons. We've wrapped them all up in a div tag. Let's have a little look at what we've ended up with. So I'm gonna open my ports and because I kind of working on something else I'm gonna basically close it and then open it back up again. It's gonna open up on this video over here and I've broken everything. So we totally broken lots of things with our code so we're going to go through and I guess that's why I wanted to do it is its own separate window. So if you're doing at the beginning it can be easier. But when you're adding things in later on there is this packing going on to try and repurpose or re fix it? So actually we've used that button already. Let's just get rid of it off here in case of these a tags because it's applying twice. Right? We've got trying to do it twice. So we don't need it on these a tags is more because we're using it on our div class so I will get rid of all of this. I'm gonna hit command d to get rid of that one or we don't almost I'm gonna use my multi cursor. I'm holding it on my option key on a Mac. Ok. Or OK. On a pc. So now just got plain old classes wrapped in these tags with that same style on it. Let's have a look now better. Alright, next thing let's get them stacked side by side. Okay. So we're going to say you my friend. Who is that? Never button? Do we have a class for never button. Okay, so never button is going to be what are we gonna call him? We're going to say he is display Okay and he's blocking at the moment so he's stacking onto a virtual so the other one is in line block. There he is there. They should line up next to each other. Cool. Now we're going to do that. Drop down menu. Okay it's going to be inside this book online we're gonna hover above it and it's going to fall out. So let's look at the code let's find book online. It's inside this div tag called nav button so the beginning the opening so just after the a tag is where I'm gonna put everything I'm going to put in a few returns to make it look nice and we can now just do that, grab that one, Copy it and put three buttons in. Okay that actually works okay but there's nothing wrong with that. Okay the tags open and they close but the tabbing is all weird. Okay so I could right click it and say let's format the selection but I want to try and be fancy and ho nail skills to try and this is like only do this stuff when people are walking past behind you and you're trying to impress them. That's what I do because it takes me a little while to work out okay that I want I would like a div tag called nav button. Okay. Inside of that. Okay I'd like some eight tags and then how many do you want? You want three? Okay and I know that's not gonna work but let's just say let's do it. You're like huh? I kind of did what I said I said do and have button and then just times the A. By three. So what you can do is you can wrap all this up. Okay you can say open brackets, closed brackets so do all of this and then times them all by three not just the A. All of them. Okay and sometimes you need to delete that last bit. Three type it back in. So the abbreviation pops back up. Hit return. Hey we're doing stuff okay. Multi curses. We're gonna put in hash we're gonna put in the three little bits. Okay so I'm gonna grab it from my ah the text I've got in your exercise files okay. And inside the a tag and I paste that parts delivered. The last one is going to be request callback. Okay I got all of them, mostly in the right places ever look what end up happening. Yeah so you're inside worked out. Okay But I know that this needed to go inside the a tag there. Now the cool thing about it is that this div has an a tag inside of it. Okay and it's exactly the same as doing it this way. Okay where we've got a div with an a tag inside of it. It's exactly the same. Just looks a little different here. Okay. Especially when I've broken it. I didn't break it. It's just folded onto two lines. Let's make this a little wider so it all fits all right. So we've got these guys, what do you want to do to them? We want to turn them off because at the moment they're appearing okay but who have I broken something I did. Good old venus code helped me putting a closing dip just there, which is not what I wanted. There we go. So it all looks nice. Now let's turn these guys off so these guys need to be inside something I can turn off because it's not we're going to use our super handy dandy. Remember the long way view command palette but we're gonna use a shortcut ready? I'm trying to impress. You hear? Command shift P look at that. Just hanging out. The last thing recently used was Emmett Great. I'm going to type it in. I'm going to call this one. Drop down. Ah look at that he'd return again. How casual look at us wrapping tags looking good and denting. Okay. And let's turn it off. So we're going to say drop down is what I called it is it? And we'll say display none. Go away buddy. So now if I save it all it's gone. I want to turn it back on so I would like drop down drop down. Turn back on please. Okay I'll display block. It turns into a block that we can see but only if Okay, only if this never buttons been hovered over this never button. So if the never button button has a pseudo class of hover, Okay then do this thing and it will override the display from none to become a block. Mm hmm. Hey, it doesn't work well it works but it's the format is a bit weird. Let's try and fix that. Okay. And I guess is how that was done. That was a hard thing because like this is a I only really remember it because I'm a teacher of it. What I end up doing is end up doing it once a working through the tutorial and then copying and pasting it over and over and lots of my projects. I understand how it works, but typing it out every time, that's pretty long. Not even sure how long we're at this video yet, it's probably what I'm guessing. 10 minutes maybe. Maybe not that long. So to get it to position right, okay, we're going to say the position instead of being relative to each other and all of his friends were going to position is absolute alright and hopefully now he kind of he's distanced himself, he's not relative to his buddies and that's kind of working and to get these little guys that pop out to fix them. We need to find our nav never button where he is there. Remember we did this before we said okay now you're a position relative you're gonna work down nice you need to be a little wider. We need to do some centering but that's the basics of it. Right And my Z index doesn't need to be adjusted because this stuff is appearing afterwards. Okay sits on top but we might have to go and say just in case. Okay you might have to say your dropdown menu has a Z index of one. Okay just to get him or 99 just above zero. What do you want to do now is we wanted to push down a bit so we're going to say this drop down menu now we're not gonna use margin remember because margin left a gap that this thing closed. So we're gonna use petting, what are you petting padding top. Okay and we'll add a bit how much pixels. Let's see how that goes. Get in there. Okay And we want to center all these knobs buttons. Okay so all of you guys can I do it just to the drop down box. So these guys are all fine because they fit within their little boxes. But this guy here we might have to say we'll try it together so it takes the line can be center. Yeah that for all the little internal guys as well so that's nice we might make those boxes wider. So the dropdown menu is going to be can we do it to the drop down menu? I doubt we can. If we say with We're learning together with of let's say 200 pixels just to see if we can do it. Cool. It is kind of yeah, it's totally working but it's not forcing them to be a size, it's giving the box nice and big and it's allowing them to be whatever size they like and that could work if it's just text but it's kind of making the boxes weirdly size. So yes and no it worked. So we're going to need a compound selector to say I would like the I want to start these never buns but not all of them. Just the ones that are inside of the dropdown. Okay, so we use a space to say this thing inside of this thing you're getting the hang of it right? So I would like to say that as a width of Width of 100 pixels but it was big enough to fit all these guys not big enough. 200 pixels. Probably too big a lift the two off count too fast. Here we go. I totally did it the wrong way around. Okay, so it's not drop downs that are inside never buttons, it is the knave buttons that are inside the dropdowns Happens to the best of us. Here we go now the 200 pixels and too big. Okay, so maybe 90. It's not big enough. 1 20. Alright, that's perfect dish. Maybe a little bit bigger. I'm gonna leave that on two lines and if we wanted to because those lines are joining, I could use margin but it's going to open up a little gap so I might just say the background background color of these guys are going to be a background color, it's gonna be slightly different. We're going to use white. Okay, so they're all white color of the text. Okay, so colored by itself. Remember changes the color of the text. I'm going to use this. Ah not working so it has to be not you. Alright, should have left it there but let's learn it. So if there's a drop down inside I'll put the colors down here. Ok. And I'm going to say I'd like this but I want there to be an a tag. Okay, that's inside of an on button that's inside of a drop down. I want you to do a color of that green. Sorry, that magenta. There you go. We're getting there. Okay, get what I mean? Now I'm just kind of playing around trying to make it look nice. Okay, you can add your hover transition, you can play with your margin kind of moving it over to the left if you want. I'm gonna stop there though because this video is getting along and I'm just kind of mucking about And it is 10 minutes to 11 at night and I'll probably just start waffling. So let's finish up there and I will see you in the morning.