How to pin the navigation to the top of a website fixed nav

This lesson is exclusive to members

Course contents
SECTION: 4
Project 2: Bike Repair Website 6:12:48
SECTION: 6
Project 4: Bootstrap Yogurt Website 3:35:39

Questions

You need to be a member to view comments.

Join today. Cancel any time.

Sign Up

Course info

128 lessons / 17 hours 5 projects Certificate of achievement

Overview

Hi there, my name is Daniel Scott and together we’re going to learn how to build professional responsive websites. which look good on mobiles, tablets and desktop screens.

We will build 4 sites together...
  • a simple but elegant restaurant website.
  • a bike repair website. 
  • a responsive portfolio website.
  • a Bootstrap website.  

We cover everything you need to build your first website. From creating your first page through to uploading your website to the internet. We’ll use the world’s most popular (and free) web design tool called Visual Studio Code.

There are exercise files you can download and then work along with me. At the end of each video I have a downloadable version of where we are in the process so that you can compare your project with mine. This will enable you to see easily where you might have a problem.

We will delve into all the good stuff such as how to create your very own mobile burger menu from scratch learning some basic JavaScript and jQuery. 

 You will...
  • Learn how to work with responsive images and icons. and stunning full screen background images and probably one too many gradients. 
  • Learn how to create forms and to choose great fonts for your website. 
  • Learn how to work with Bootstrap 4 to easily add carousels, cards and complex looking menus. 
  • Setup a domain name with hosting so that your website is live on the internet for others to see.  

There are fun class projects for you to work on which will enable you to practice what you learn. By the end of this course you’ll have a great understanding of important web design topics like HTML5, CSS3, Flex box, Responsive design and Bootstrap.   

If that all sounds a little too fancy - don’t worry, this course is aimed at people new to web design and who have never coded before. We’ll start right at the beginning and work our way through step by step. 

Who am I? 

I’m Dan, and I’ve been building websites for about 15 years now. I am award winning instructor, and have won a MAX Master award for the last 2 years in a row at the prestigious Adobe Max conference.

Time to upgrade yourself?
Sign up for the course and let’s learn how to build responsive websites.

Course duration 16 hours 42 mins
Daniel Scott

Daniel Scott

Founder of Bring Your Own Laptop & Chief Instructor

instructor

I discovered the world of design as an art student when I stumbled upon a lab full of green & blue iMac G3’s. My initial curiosity around using the computer to create ‘art’ developed into a full-blown passion, eventually leading me to become a digital designer and founder of Bring Your Own Laptop.

Sharing and teaching are a huge part of who I am. As a certified Adobe instructor, I've had the honor of winning multiple Adobe teaching awards at their annual MAX conference. I see Bring Your Own Laptop as the supportive community I wished for when I was first starting out and intimidated by design. Through teaching, I hope to bring others along for the ride and empower my students to bring their stories, labors of love, and art into the world.
True to my Kiwi roots, I've lived in many places, and currently, I reside in Ireland with my wife and kids.

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.

Downloads & Exercise files

Download Exercise Files Download Completed Files

Transcript

Hi there, we are going to make our navigation fix to the top. So we're going to start with this where it scrolls up and disappears, and then we're going to do this, where it stays fixed, and stuff slides up underneath it. It's super easy to do, let's jump in and do it now in CSS. 

First of all we need to identify our thing that we're going to pin. So we don't want to pin just this little chunk here. We want the whole big gray box. So let's have a look at how to do it. So the big gray box is, we called Header Container, that's this fellow. So Header Container has some styling over here, already, and all we're going to do is add two bits, the main bit is position, and fixed. Super simple, let's give it a preview. 

It kind of works, and you're like, "Wow, that didn't work at all." It needs a width as well, so we just need to say-- because by default it was a width of 100%, but obviously position, does some strange things to it. Not widows, we need width. We'll do width, and we'll say 100%. Now it should work, and when I scroll, there's not much scrolling going on. You need to fake the scrolling to go up and down, and you're like, "Yeah, it works," it's ignoring me, it's all slipped underneath. 

By putting it fixed it means it's come out of the flow, and there's no longer blocking. It's not blocking the rest of the guys, and pushing them down. So we're going to have to fake the gap in there. I want you to pause the video now, and just have a, just a short little think. Maybe test out a few ideas of how you might solve this, because that's what I love most about Web Design, is that it is a big old puzzle. There's a solution for it all, if you've seen it on another web person's website, it means it exists, so we all know that it can happen, that you can have a Header at the top, and stuff that doesn't slide underneath. You've just got to kind of think and try and work out how to do it anyway. That's what I love about Web Design, it's a solvable Rubik's Cube. So have a pause, have a think, and I'll do it with you in a second. 

Did you pause it, did you have a think? Did you make it work or you just got some good guesses, let's have a little look. So the way I thought about doing it, is the container, it's underneath. It just needs to be pushed down a bit. So if I find the container and add some stuff to the top. Padding or margin? I think both will work, we'll try both just in case. Put some padding to the top. They should both work. Let's put in like, let's try 150 pixels, have a look. Here we go, worked just fine. Is that enough? Yeah. 150 pixels, great. 

So it slides up underneath, but starts off with a bit of a gap. Basically we're putting in however high that was. How high was the Header container? So it had a min height of 100, plus some padding at the bottom. So let's say 140 should match exactly what we used to have. So those two together. Now how much do we need for margin bottom? We do not need that at all anymore, do we? No. Always, when you are kind of fixing one thing, try and delete the other things, because later on you'll be like, "Oh, is there a reason I put in the margin bottom, is that essential?" While you're in the midst of that you're like, "Actually I don't need that." 

All right, that's how we do a fixed navigation to the top. Pretty easy, don't forget the width. On to the next video.
  • Powered by Marvin
  • Terms of use
  • Privacy policy
  • © Bring your Own Laptop Ltd 2024