Skip to main content

How to make a burger menu 3 line mobile navigation for a website

Lesson 95 from: Build a Responsive Website Using HTML5 & CSS3

Daniel Walter Scott

How to make a burger menu 3 line mobile navigation for a website

Lesson 95 from: Build a Responsive Website Using HTML5 & CSS3

Daniel Walter Scott

buy this class

$00

$00
Sale Ends Soon!

starting under

$13/month*

Unlock this classplus 2000+ more >

Lesson Info

95. How to make a burger menu 3 line mobile navigation for a website

Lessons

Class Trailer

Getting Started

1

How This Class is Structured

01:41
2

What to Download

02:57

Introduction to HTML & CSS

3

Creating Our First Webpage

05:55
4

What is HTML5 & CSS3

08:24
5

Head vs. Body vs. Html Tag

09:01
6

Title & Description

05:54
7

What Code Editor Should I Use

02:42
8

Using Diy Tags

06:26
9

What is a CSS Class

09:05
10

How to Create Nested Divs

05:03
11

Class Project

05:24
12

External CSS

09:07
13

Creating Our Index Style Pages

12:16

Project 1: Restaurant Website

14

Testing Your Website

08:47
15

Check Your Code For Errors

11:01
16

What are HTML5 Structure Tags

05:47
17

Add HTML5 structure elements

16:02
18

How to Set the Color of the Background

05:10
19

Adding Images to a Website

04:38
20

How to Center an Image

01:14
21

Change the Font Size & Color

14:11
22

Make a Clickable Link

08:45
23

Stretching Background Image

05:38
24

Making a Div Tag Transparent

02:36
25

Simple Website Text Navigation

06:43
26

CSS Compound Classes

07:02
27

Class Project 02

02:05
28

Class Project 02 - COMPLETE

04:48
29

Add an Email Button to a Website

03:49
30

Add Google Maps to Your Website

11:25
31

Making a Website Live

16:50
32

Uploading via SFTP

11:50
33

Setting Up Our New Project

03:46

Project 2: Bike Repair Website

34

CSS Reset

15:22
35

Min-height vs. Height

07:01
36

Div Tags Onto One Line

05:23
37

Getting div tags onto one line using Flexbox in HTML & CSS

05:23
38

Evenly Spaced Div Tags

04:42
39

Two Div Tags of Different Sizes

07:13
40

Vertically Center Content

07:20
41

Class Project 3

02:51
42

Class Project 3 - COMPLETE

05:39
43

Change Default Fonts

04:19
44

Installing Google Fonts

12:44
45

What are PX & EM & REM

14:56
46

Change Line Height

04:33
47

SVG vs. JPG vs. PNG

07:04
48

How to Create a SVG, JPG, or PNG

11:00
49

Block Images vs. Background Images

08:32
50

Finishing Up Our Cards

09:10
51

Icons via Font Awesome

16:31
52

Making a Div Container Clickable

09:55
53

Box-sizing & Border-box

06:19
54

How to Make A Colored Button

07:46
55

Why Can't I Add Margin or Paddding

11:08
56

Rounded Corners

04:17
57

Drop Shadows

06:24
58

Backup Your Website

05:00
59

Reusing a Button Class

03:10
60

Class Project 04

02:58
61

Class Project 04 -COMPLETE

05:45
62

Adding a Horizontal Rule

03:51
63

Make Divs Wrap Onto Separate Lines

12:14
64

Hover Color & Animating a Button

03:33
65

Pseudo Classes

09:31
66

Simple Dropdown Navigation

20:04
67

Adding Our Dropdown to the Website

14:50
68

Useful Shortcuts and Tips in VS Code

13:28
69

Large Background Image

09:24
70

How to Connect 2 Pages

10:42
71

Simple PHP Form Work

17:49
72

Placeholder Form Text

05:46
73

Form Check Marks

03:04
74

Multi Line Form Text Box

02:18
75

Form Radio Button

06:07
76

Form Drop Down Menu

05:48
77

How to Style Your Form

12:55

Project 3: Responsive Portfolio Website

78

What does responsive website design mean

04:17
79

How to change a website layout size color when at different sizes using media queries

11:28
80

How to test your website on a tablet or mobile phone from Visual Studio Code

06:00
81

How to change the layout of a responsive website for mobile vs desktop

16:02
82

How to turn things on and off for mobile tablet & desktop responsive websites

06:03
83

What is pixel density responsive images pixel ratio dp px in webdesign

14:47
84

How to export responsive images for website from XD Photoshop Illustrator

05:11
85

How to add responsive images to website using 100% width in HTML & CSS

06:08
86

How to use srcset to change images in HTML for responsive website

11:18
87

How to add a css style to the first line of a p tag on a website (

11:18
88

How to make the header footer full width but the inside centered

05:36
89

Class Project 05 – Header design

03:12
90

Class Project 05 – Header design COMPLETE

06:25
91

How to use a span tag or span class in HTML to change text

10:32
92

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

03:17
93

How to make a simple responsive mobile menu using CSS only

08:21
94

What is Javascript vs Jquery in website web design

06:35
95

How to make a burger menu 3 line mobile navigation for a website

15:11
96

How to switch a menu nav from desktop to mobile phone

21:45

Project 4: Bootstrap Yogurt Website

97

Overview of what Bootstrap 4 is in website design

07:57
98

How to install Bootstrap 4 on a website using Visual Studio Code

06:27
99

Quick overview of how the Bootstrap Grid Layout works in VS Code

10:49
100

Quick overview of how Bootstrap Components works in VS Code

09:23
101

Quick overview of how Bootstrap CSS Styles works in VS Code

08:20
102

How to customize the default Bootstrap 4 css styles

13:51
103

How to use Bootstrap Layout Grid Experiment 1

10:20
104

How to make 100% header & uneven widths in Bootstrap 4

07:16
105

How to create uneven col widths in Bootstrap 4

07:27
106

How to add padding & margins using Bootstrap 4 in VS Code

12:03
107

How to change layout of Bootstrap depending on mobile or desktop

15:46
108

How to turn things on & off on your website using Bootstrap 4

05:30
109

Google Chrome Inspect

12:40
110

Add Shadows to Text & Boxes

07:06
111

Change the Default Buttons

06:16
112

Responsive Images in Bootstrap 4

09:34
113

How to Center Text & Div Tags

04:16
114

Customize the Bootstrap Navbar

07:29
115

Add Your Own Logo

03:58
116

Change the Default Nav Styles

12:12
117

Fix the Navigation to the Top

04:41
118

Col Images & Col Background

07:56
119

Bootstrap Border & Rounded Corners

04:20
120

Bootstrap 4 Carousels

05:13
121

Card Groups

03:29
122

Drop Shadows On Bootstrap Cards

02:25
123

Clickable Boxes in Bootstrap 4

04:02

Final Quiz

124

Final Quiz

Lesson Info

How to make a burger menu 3 line mobile navigation for a website

Hi there in this video we are going to create a mobile nerve sandwich that when you click it a mobile pops out and clicks back in when you click it again. We're gonna use jake query to do it all in venus code. Let's jump in now and work out how to do it. All right for this one. We're going to close down our current website and we're gonna stick it in its own pages just so that you've got a version of this, Like a vanilla version That doesn't because like if you start implementing it now into our site, okay. There are lots of the CSS resets that we might have to deal with and lots of things that you might not. So I'm just going to do a nice like pure version of it. And then in the next video we'll integrate it back into our big site. So let's make a new document. Okay. File new. This one is going to save it. I'm going to call this one. What are we going to call it? We're going to call this one. J. Query nav, J. Query hyphen nav dot html. Okay. We're going to save it. We're going to put ...

in our normal head tag stuff. We're going to link to files to it. We're going to have some CSS let's go file new file. Okay. And we're gonna go we're gonna save this and we'll call it d query nev dot CSS Nice and we'll have one more file. Okay. That we haven't had before as a javascript file. I'm gonna call it this dot Js it's probably more common to call it. Maybe script or scripts plural k dot Js. It doesn't really matter what you call it. Okay. We've got three files. Let's link them all together to the html. So up the top here before the closing of the head, we're going to link our CSS so we'll link CSS houses not called style. It is called G. There we go. J query dot CSS. Now we want to link our javascript. Okay. So in this case it's not link, it's called script. We want this one called script source. Okay. And the source is going to be, it's in our root folder and it is called bakery dot Js. Nice. Alright. So we've connected these three pages. Let's separate them out a little bit. This is a cool little option now that we've got three files. Okay, I can drag this one and say I want it over here and then grab jay s and have it over here. We can have three up. Look at that. So the first thing we need to do is we're gonna put in the little nav icon, you can have anything that can be a button and can be text. We are just going to have in our body here and we'll have an image. Okay, so we're gonna use an image and it is going to I've got this one for you in your exercise files. Okay. There's one in here. Project three. There's an icon in here. Court icon burger menu looks like that. Okay. Um now I got that from font awesome and I just downloaded the SVG. You might decide to use the icon version. Remember we learned how to do icons on a page where we put it in the head tag and linked to it using the I tag. Don't worry. We're just using an image. You can use anything you like. I'm gonna copy it. Find my local folder. I'm going to paste it in My image is wrong. one desktop project three. Put it in images and paste it and there it is there. Okay so let's go and find that one. So it is in the images which is slash icon burger menu. Okay. And this is going to be my mobile menu icon. Get in the habit of aiding all text. Now let's preview in a browser. Turn it off. Turn it on again. Alright. Giant icon. Okay. Because it's an SVG can scale to the bounds of the document and our document happens to be that wide. Okay. So it goes all the way. So what we're gonna do is we're gonna say actually before this closes the image tag we're going to add a style of width. Okay. And we'll say you're a width of pixels. Save It. Let's have a look 20 pixels. I'm going to make mine a bit bigger just so that because we're doing a tutorial. It might be a little easier to see rather than the Jason, the editor having to zoom in and back out again. It probably won't help at all. But anyway, so we've got our icon. Okay, it could just be a text with an A tag around. It doesn't matter now. We need separately from that. Okay, we need the actual menu items. So I'm going to put them in a knave tag. Okay. They don't have to go into another tag but it's good. Html Five practice. Okay. And I want how many a tags I'm gonna have? Maybe 38 tags will match what we're kind of doing in the next one way with my shortcuts there. Alright. It's going to go to hash and inside of this we're going to have well match what we were doing before in the last project. So we're going to talk about pricing and contact us. Cool. So let's have a little look what we've got. We're not going to style, it's just going to be ugly blue things but we know how to style those into a good looking buttons. Ish man. I've got a frog in my throat. I can't get rid of it. So I'm going to sound a little husky in this video. Um Alright. The what do we want to do? We want to turn this off because I don't want them appearing. I only want them appearing when we click on the button and that is what javascript going to do. It says alright, when this button is toggled, this is going to pop out and then close again. So what we'll do is turn it off with some CSS so I need to control it. So this is going to have a novel class of going to call this my and my mobile nav Good. So what I'd like to is I I'd like to style that mobile native mobile hyphen nev just to be off. Okay. We've done this kind of before we did display none to turn things off and we turned it on with media queries now we're going to turn it on and off using javascript Alright, so it should not appear now. Awesome. Nothing's working now like nothing is connected, right? It's the javascript that's going to connect the two. So the moment we just have a icon sitting by itself we have a knob underneath it that is turned off by default not connected. The next part we need to call our javascript library or J. Query library because javascript is understood by default in the browser but j query needs a little bit of library added at the top here, so just like we have loaded member google fonts at the top because the browser doesn't know what google fonts is to start with, it has to be loaded at the top here. Same with our like CSS reset. We're kind of loaded at the top so we need to go and find it and co dot J curry dot com is a good place. There are other CDN so a content delivery network but J curry is a great one. That's what most people use and we need to load it into the page. So at the moment we're at jake 33. Okay, with 3.4.1, You'll be in the future, it will be 3.5.1 or whatever it is. Okay, great. The latest version but you don't have to keep upgrading it. Okay. We're doing the stuff that we're going to do right now is stuff that's been in it for ages. Um so we can use basically any of these, we're going to use the un compressed version and here it says it says this is the script to put into your website. We're going to click this little copy clipboard. Now, if you haven't got all this, I've tried to make it easier. So in your exercise files, project three I've got or is it called J. Query Mobile nav open that up and that's the cd in their that's the link that we're at. Okay. And this is what I've just copied out. You can go grab that if you like. Plus this is the code, we're gonna write if you want to cheat actually that's their twice yours will look nicer. Okay, so we need to paste that into the head of our document. I might just make this a little bit bigger. So what we're going to do is underneath here. We're going to paste it in. No, we're not grab the wrong thing. All right, copy to clipboard copied. Let's put it into venus code. It's not copying you lie. I'm gonna grab this vision. Okay? And it goes in the script tag just like the script is getting called. The script gets called next. Now this is a big problem because because this is getting called afterwards. So this is the library, right? This is telling the browser that everything it needs to know about. J query so that it can run it, but it's loading it the wrong way around. Okay? It needs to learn everything before it can run yours. Okay? So this needs to be above and then this goes underneath. All right. I'm going to close down the CSS panel here because we don't need it anymore. And let's look at the javascript that's required. All right. First up, we want to start writing our javascript. Okay? And we want to tell it first of all that we're dealing with a query. Okay? And for this to work properly, we need to make sure that before it starts doing any of the things that I wanted to do, like the toggle. I need to make sure that the page is loaded. Okay? So we need to say the document needs to be ready. Okay, before you run in brackets are function or the function that I'm going to write. So function is just a placeholder for the thing I wanted to do. You give it some parameters by putting in a couple of brackets and inside of here you can run parameters. We're not going to we're gonna leave it blank just after that, but before the last bracket is where we put in our curly braces and inside of these curly braces was where all of the magic needs to go at the end. You put in a semi colon like CSS to say I'm done. So at the moment, all it's doing is saying yes, I'm using J query. And what I'd like you to do is don't run all of the stuff in this curly braces until the page is loaded. So like CSS we're going to put in a return okay, just to separate them out, you can have it all together. And what I'd like to do is again, I want to make sure it knows that we're running j query. But the shorthand for jay Carney is just a dollar sign. So nobody writes J query, they just write dollar sign. And what we'd like to do is inside of brackets, we would like it to the brackets and then inside of parentheses don't want to say that quotation marks, single little dots. I want to now attach myself to the icon. Okay, so at the moment we've got an image. There's an icon in SVG we've got no kind of like way of connecting to it. So we're gonna give it a class name, we're gonna say you have a class of we call it burger menu. So up here, I want to say when the documents ready, I want you to look for the burger menu and when it is being on click, I would like you to run this function. Same again we put in the brackets and then just after in between the last two we put in our curly braces to return in. So we are saying wait for the document to load, then run this function. This is the function because it's just inside the curly braces so when it's ready, do this. Okay, and what is it doing? It's saying look for the burger menu and wait for a click and then do this other thing. There's other functions. This function, same sort of syntax, dollar signs saying okay, there's J query inside of our inverted commas, I need to work out what the name of that is and what I'd like you to do is find on my page my mobile nav and turn it on. So let's make sure it's mobile nev. I would like you to toggle it, okay, toggle brackets and then finish that off. I don't want to do anything else now. Toggle doesn't really do anything other than it's going to look for that CSS we've got and turn it to its opposite. So at the moment it says where is our proper CSS there? It is the moment says display none. It's gonna toggle that and become display block awesome. That should work. Let's save it. Let's have a little look where are you? Toggle? Toggle toggle and that my friends is a super simple but super effective mobile navigation using javascript. Really just j query Now. A couple of other things important things to know about using Javascript is in visual studio code here and it's very common to have the script tags. Okay. Anything that's javascript. So what we've got two parts, we've got my one that we made. Okay. And then we've got this which is the C d n K. That's been delivered by who? By code dot j. Carey dot com. Okay. This is all javascript. It's better to have it at the bottom of the page just before the closing of the body. It's kind of a weird one, right? Like and do you think you'll see it on the page and just have a look. Okay. Nothing changes. It still works and it can't be seen because it's inside those script tags and it's just really common practice. You can have it at the top and it's just common practice to have it at the bottom for a couple of the main reason is page load speed Okay, so this is actually quite a big library to download. So what can happen is the browser can load all the things on the page super quick so the user can see them and then later on when it gets to it finally loaded the pages, it can load the scripts and can take its time to do that. But we're talking like seconds or milliseconds so it's fine to have it at the top, but if you've got people racing through your site, like click click, click, click, click click and what might happen is they'll get to a page trying to click on something and nothing will appear because it's still trying to work its way through this. The other big thing is just make sure this the order is Right, okay, so you need to load the library first then your script. Cool. So we've got the basics in a couple of little things you can do to tweak the j query. Okay, this toggle value here, we can actually add some attributes to it. We can say in quote marks, we can say go slow, save it and let's preview it. Okay, let's click on it goes very slow. Okay, and you can imagine if you could type in fast, it is true. You can make it go fast on that one. Nice and fast if you're really particular. Okay, you can type in milliseconds, so get rid of the quotes and just type in straight up. That is one second 1000 milliseconds. So I could put it in for three seconds, let's have a look extremely slow. There you go and what else I'm going to go back to just leaving it default look nice. Alright, so we've just used plain old toggle. There are some other kind of similar ways of turning it on and off toddling. Let's look under So I'm just at w three schools dot com. It's really nice. Clearly described and place as editorials will look at javascript J query and we're looking at these effects here. So I think hide show is just our regular old toggle. He's in here. Okay, but there are like you can do a bakery fade. Let's have a look. So you can kind of see it says J query fade, toggle okay. It needs to be this kind of camel case which is kind of strange, we haven't done that yet because the you can kind of understand why it's camel right, it's got a big hump in the middle or it's got uppers in there so it has to be exactly written that way. So I can say fade uppercase T for toggle and let's have a little look go back to my menu there. It is there. He failed tuggle. There is a slide toggle. Okay, and slide toggle capital Team, exciting. Alright, so we're not going to go through and start styling those menus because we've got that structure kind of working but now we need to implement it into our big site. Okay, because at the moment we only have a mobile Nav. We want to do the whole switch from desktop to mobile. We'll do it in the next video. But basically this whole group. Okay. We're just gonna delete, Okay. We're going to then we'll delete it. We're going to disable it and only turn it all on for mobile. And we're going to have a completely separate menu for desktop, Easy to say, let's go and actually implement it in the next video.

Class Materials

Bonus Materials with Purchase

Exercise Files
Completed Files

RELATED ARTICLES

Recent

Articles

Recent

Articles

Recent

Articles

Recent

Articles

Recent

Articles

RELATED ARTICLES

Recent

Articles