This lesson is exclusive to members

Responsive Web Design Essentials - HTML5 CSS3 Bootstrap

Class Project 03 - Flexbox Header COMPLETE

Daniel Walter Scott

Download Exercise Files Download Completed Files



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.


I recommend hosting your new website with Bluehost, you can get a big discount by signing up with this link:

You need to be a member to view comments.

Join today. Cancel any time.

Sign Up
All right, remember this is what it's going to look like when we're finished. There's the logo on the left, the Nav on the right, it's not really doing much Nav-ey stuff, but you get what I mean. Just placeholder text for the moment. All right, let's get started. Let's see how this goes. 

It would be interesting to see, if you did do the homework and you were comparing yours with mine, let's just see how yours differed. If you got to the same, the right place, and it looks like we described it, it doesn't matter, there's no right or wrong, but it's broken, that's wrong, but if it looks fine, that's great. 

First of all, inside of the Header we're going to put in two Divs. Now the first one, there's no predefined logo. So we're going to actually create one, called Logo, and we'll put our image in there, and we'll create another one called Nav, but there is a Nav. If you went and called that div class=nav, that's fine too, don't worry about it. 

So inside the logo here I'm going to put in my image. I need to copy and paste it over, because it's in my Exercise Files, Project2, it is called Logo. We're using the PNG. Don't worry if you use the SVG but, we'll look with SVGs later on in the course, but for the moment I'm going to copy it on my Desktop, find my local folder, and go to Project2, my images, I'm going to paste it in here, I've already done it. Replace. 

Next thing I want to do is add it in, so Images, slash, ‘images/’, and there's the logo there. Make sure you add your Alt text, so this is the logo for Bike Repair Shop. Roar Bikes. Let's check it in the browser. Awesome, our logo's in. Next, let's add the Nav. Now I just said, add the text, this might've been a little confusing. It's going to copy it out of the Project file, I'm going to paste it in, and I'm going to get rid of that. Save it. Let's have a little look, so I've got some text. 

Now I need it to be over here on the right. How did you do it? There's a couple of ways. The way I'm going to do it is I'm going to say, the Parent, which is the Header, I'm going to say, I would like you to display, and I'd like you to display Flex, please. There you go, they're side by side. 

Next thing I want to do is I want to get it pushed over to the right, and get it in the center, let's do the going over the right. I'd be interested to know if you got it going differently to me. So in VS code here I'm going to say, Header, and I want you to just divide them up for me. So I want to go to Header, and I want to say Justify, and I want to Justify the Content, and I want to say, was it start around? Space Around. So I want the space between, separates them out. That might be the one, and if you're, "Ah, I didn't even think of that", you can kind of see, it spaces them out, and put space in between them nice and evenly, and no gaps on the side. 

You could have done it a different way; trying to think of another way. You might have right aligned the Nav. Write in the comments if you did come up with another way. Oh, I know the other way, you might have done it, you might have done Flex. Flex1, and then Flex2, it might have got it across, and then Right Align the text in it with a Compound Selector. Oh, I'm interested now; let me know what you did.
Next thing I want to do is get it in the middle here. So we're going to use something similar. We're going to go, we did it before, Align Items, and we're going to go Center. Let's give it a look, there it is there. You do get confused sometimes. Can you see there's an Align content, and items, and self? Basically items are single line, contents is groups of lines. It's probably easy to show you in the-- there he's here, let me zoom out a little bit. I'll zoom out so that the editor can zoom in. 

So Align Content to the Center, can you see, there's more than one row of content. It's like groups of stuff in there, and it's still aligned center in the Div, whereas if I scroll up, things are a bit jumpy. There it's there, Align items to the Center. Can you see, it is just one row, they're all squeezed on to one line. Items, individual; content, groups of stuff. Don't worry, I forget, you'll forget. Try both, and we will update later; thank You, Microsoft. What else did I say to do, I said, let's get rid of the minimum height, and add some Padding top and bottom. How much Padding, can't remember, I'm just going to add--

And what did you do? I did Padding, Padding Top. Padding; come on, Dan. Padding Top, and we'll say 20 pixels, we might change this. Top, and same for the bottom. The height could probably stay there, but I want to kind of-- yeah, we don't need the height, so why have it there? So I've got a bit of Padding either side. Did I say anything else? I said Colors. So I said, Background Color, now how did you do your Background Color? Hopefully, we did this, to the Body. It sets everything on the page, we went Background Color. There we go. We got to put in that, there we go. 

You'll notice there's a couple extra spaces in there, it doesn't matter. There you go. Let's get rid of the Header color, goodbye. Tidying it up. And that is it, we've got everything we need. Let's have a little look; cool, that was our task. I wonder how you got there if it's slightly different. Leave me a message, send me a comment, send me a screenshot. And yeah, that's it, I'll see you in the next video.