How to make the header footer full width but the inside centered
Hi there. This video. We're going to make a navigation along the top here. That part of it stretches all the way to the outside. But part of it is lined up the logo and the navigation here. Line up with the structure of the rest of this website. The coding is not particularly hard. We've just got a wrapper container that goes 100% inside of it nested inside is its child and it's just a fixed width box. Seems simple. But I remember when I first kind of tried to do it, it's a weird old inception type thing where he who goes where, where's what inside of what here? All of that craziness is explained in the simple video. I'll see in a sec. Alright, so you can see my dilemma. I have two things. I want this to go all the way to the edges, but the inside parts to stay here. So basically it's just two nested gives nothing to do with this guy down here. This guy could not exist. Okay. And it would still work. So we're going to forget about the container and we're going to move him down and we'r...
e going to grab it all and make it look pretty just because format selection. There we go. So it's now indented nicely. Okay, so here, so that's the beginning of the page. I'm going to add another container called hitter container. Cool. All right. And that guy is going to all he's going to do is stretch 100% with okay. Which is exactly what he does anyway. I'm just going to put it where about there? This is the beginning this guy is what is it called container Consistently spell that one wrong and we don't have to deal with right because by default it should reach left and right. So let's put a background color, background color. I was going to pick gray, click black then drag this around. Yeah, that'll do. Alright. So we've got a gray in there and we need a little bit of a height. So we'll just put it in a min height for the moment just so we can see it. Put it in 100 pixels and let's have a look in the browser. There we go. So by default it will stretch all the way along. It's a block level element because it's a device that pushes it down and it's got a background color. Let's put a little bit of margin on it while we're here. So we'll go margin margin bottom. Okay. And I'm gonna put in, I'm not even sure. pixels. Let's have a look mm hmm. Keep jumping to the wrong one. Yeah, 40 pixels is fine. All right. Now we need to put this internal container. So we just need inside of our container. We're gonna put another div called actually we're not going to use the header. Okay. So we can use the pre made tag. He can go in here and we'll style him. So what do we need to do for this fella let's just get a background color for him first and he had It doesn't need the full stop remember because it's a regular old HTML five tag. Okay. And I am going to do two things. I'm gonna give it a width. Okay, so we're gonna match whatever we've got our container for. So let's just steal that. Okay, so I got mad with let's give it a background color. Not for any good reason. Just because I want to show you where it kind of finishes. We'll use blue violet. It's going to be exciting. Okay, let's have a little look show even it won't So it needs a minimum height. Okay. I'm not going to get rid of these minimum heights, both of them in a second because I don't need them and it's almost there. So it's the right width. Okay, It's inside this but it needs to be centered. Remember how to do that. Okay, so this headed needs to be margin. Okay, the left needs to be auto and the right needs to be auto but the top and the bottom has to be zero zero auto should do it. Here we go. Now. We put stuff in here and it will be in the center but if we get rid of background color it's not going to be visually see a ble it's not a word. I know, but so what we're gonna do now for the rest of the video is you do the same for the footer? Just needs to be outside of the container. Okay. We don't want it inside of there because that container is forcing it to be a width so just make sure it's outside this guy. Okay. And put in a footer. Okay. Instead of header, do the exact same thing where you need a footer container and then your foot or inside of it. What I want to do now though is added some basic elements so that I can set some tasks for you to do on your own in the next video. So let's put in some core parts. So at the moment we have a header with a big purple background which we don't need anymore. Goodbye. Actually I'll leave that in there and comment it out so that in case yours isn't working, you can check mine. Okay. And inside the header I want two tags. Remember there's no such thing as a logo, like predefined one, like header. So you have to add our own class Okay. And inside of this is going to be some text. Okay, wow, this is my name and paste it in there and also in there just afterwards there's going to be another div tag called Nav but remember there is a specific name okay for that called Nav. What if you do it dot No, it wouldn't matter if it would work just as good but we should try and use the correct semantic markup. Okay. And there is some text about pricing contact. You can just type those in. All right. What does it look like now? You're not very good, but it's enough to get us going for our next project. Get ready, homework time in the next video. I'll see you in a sec.