No JavaScript, No Hacks Hamburger Menu Interaction
Key Takeaways
The video demonstrates how to create an interactive hamburger menu using HTML and CSS without JavaScript, utilizing the new HTML popover feature.
Full Transcript
this right here is a very simple menu you click a hamburger icon and it opens up a navigation now the thing that makes this really cool is that there's no JavaScript no weird checkbox hacks it's entirely just HTML and CSS this here is the future of frontend development but you can't use it just yet as it's not supported in Firefox and there are accessibility issues however it's still intriguing to see how we'll become HTML programmers in the future if you enjoyed this video check out designc course.com where you can learn uiux CSS and more with my custom interactive platform that makes learning fun and easy all right so let's get started here I'm in a HTML file and of course this is where it all begins and we're going to wrap the uh hamburger menu and the menu in the navigation itself inside of a header element now next up we're going to have the button all right so this is the hamburger button and we're going to use a button element for this now this is real important this is the logic portion we want to put in an attribute that's specific to this use case called pop over Target and then we want to bind it to something called menu of course this could be any name that you wanted to give it now inside I'm just going to use an SVG graphic I'm going to paste in just the three you know kind of stylized design for hamburger menu nothing important happening here but this however you want to pay attention to so after the button we're going to have a nav and that's going to have a few attributes as well so we have to Define an attribute called popover letting us know that this is the actual pop over the thing that will pop up now we also want to put a rule attribute and bind it to menu and it will also give it an ID of menu as well all right menu menu menu so after that we're going to also have a close button so again we're going to use the button element and we can also use the popover Target menu as well so let's go ahead and just copy this stuff all right and then we're also going to put in popover Target action I know it's kind of a big mess I equals hide so hide and then I'm going to put in another SVG graphic for a close sort of button and then we're going to have an unordered list which is be our typical navigation structure home preferences my account support whatever and that's it I mean that's literally all we need to do just to fill out the page a little bit I will put a main with an H1 that says no JS menu reveal oopsie right there yeah all right perfect so now that we have that I we can go ahead right click open with live server and we'll see if this thing even works let's click it yeah it actually does work look at that so this is the default styling that's present I when you use this popover here in Chrome all right uh it you can see it's centered it has an outline we can override all the stuff and even apply transition animations with CSS so let's go ahead and focus on that so I'm going to paste in just some basic rule sets here nothing nothing exciting happening here um we're also going to go ahead and give our buttons styling here again nothing is crazy is happening here with respect to this new way of dealing with menus um now we're going to have a nav element okay so everything's going to be pretty much typical uh when with this rule set so you know as you can see I'm just using uh a width left bottom Auto you know we're just moving things around giving a different background color no border like that white border or that black border you saw height 100 viewport height we're just kind of getting the menu itself when it comes out styled all right so if I Sav this now when we go back and look at it I it should look like this all right look look at that okay so we're getting somewhere now what we want to do is I want to specify a translate property 100% on the x axis so when we do this and I go back we can't see it because we've moved it out of the way it's off it's off to the right out of the browser you can't even see it now we also want to apply if we wanted to have a transition um when it comes back we also want to apply a transition property but what's what let's wait for that part um let's actually get it showing up again and the way we can get it styled back to 100 or to to zero on the x-axis is simply we're going to say an pop over hyphen open and we say translate 0 0 all right now let's save this and see what happens at this point so we click it all right so it's basically the exact same behavior that we had before I but it doesn't look like it's different because we're not actually animating it at all so to do that we want to put it in a transition so our transition property here is going to be translate 0.5 seconds and then also display 0.5 seconds ease out and allow hyphen discret so if you don't specify this this will basically not work it won't work correctly we also need to specify in at roll starting hyphen style and we simply take this value right here and paste it in here so it's kind of defining and it's it's letting this new system know that translate is 100% on the xais axis rather when you know uh in its default state or starting state so if we save this and we go back look at that so now we have a nice transition and it works exactly as you expect except without any JavaScript um we'll find on a final note just because this looks so ugly I am going to paste in just a few more rule sets right here again it's not really pertinent to the purpose of this tutorial but I'm just going to go ahead and do it because I'm a designer I'm a little bit I can't leave the tutorial looking like that so if I click this there we go much better you could add some hover interactions if you wish but this is exactly how it works so our Clos button works this button works it opens it up we can also use the ES Escape key and we could also just click anywhere on the outside of it so all this functionality is built in to the system in the browser simply using HTML in CSS which is freaking awesome of course you can't use this right now or you shouldn't rather uh because there are accessibility issues like I mentioned at the beginning of the video and obviously Firefox this doesn't yet exist but anyhow it's fun to look at the how things will be done in the future so that we can worry less about having to program stuffff with JavaScript all right everybody if you enjoyed this make sure to subscribe and I will see you all very soon goodbye
Original Description
https://bit.ly/410u02U 👈 Design & code like me. Use "BF2023" for 50% Off!
https://designcourse.com/af 👈 My upcoming "Advanced Frontends" Course
-- Today, I'm going to show you an entirely new way to create interactive menu reveals with the new HTML popover. Caution: You cannot use this in production yet, as it's not supported in Firefox and does have accessibility issues. However, it's always intriguing to see how we'll be handling these common interactions in the future!
0:00 - Intro
0:33 - HTML
3:05 - CSS
Let's get started!
#frontend #css #html
- - - - - - - - - - - - - - - - - - - - - -
Subscribe for NEW VIDEOS!
Learn UI/UX: https://designcourse.com
My personal FB account: http://fb.com/logodesigner
Coursetro FB: http://fb.com/coursetro
Coursetro's Twitter: http://twitter.com/designcoursecom
Join my Discord! https://discord.gg/a27CKAF
^-Chat with me and others
- - - - - - - - - - - - - - - - - - - - - -
Who is Gary Simon? Well, I'm a full stack developer with 2+ decades experience and I teach people how to design and code. I've created around 100+ courses for big brands like LinkedIn, Lynda.com, Pluralsight and Envato Network.
Now, I focus all of my time and energy on this channel and my website Designcourse.com.
Come to my discord server or add me on social media and say Hi!
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from DesignCourse · DesignCourse · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Photoshop Pen Tool Tutorial (Tattoo Design)
DesignCourse
How to Design the Microsoft Logo in Photoshop
DesignCourse
Photoshop Gradients Video Tutorial
DesignCourse
Your Guide to Layer Styles
DesignCourse
Layer Masks in Photoshop
DesignCourse
iOS App Icon Design Tutorial in Illustrator CS6
DesignCourse
Illustrator CS6 Logo Design Tutorial - Archfold
DesignCourse
Photoshop CS6 3D Tutorial - Magic Tent Illustration
DesignCourse
How to Design a Tshirt Tutorial - Adobe Illustrator
DesignCourse
Types of Logos - Lettermark & Monogram Logo Type
DesignCourse
Banner Design in Photoshop CS6
DesignCourse
How to Design a Logo in Illustrator CC
DesignCourse
Designing a Logo in Photoshop CC
DesignCourse
1. Launch & Market a Web Based Business - Introduction
DesignCourse
2. Launch & Market a Web Based Business - Logo Design
DesignCourse
3. Home Page Mockup in PS : Part 1
DesignCourse
4. Home Page Mockup in PS : Part 2
DesignCourse
5. Home Page Mockup in PS : Part 3
DesignCourse
6. Home Page Mockup in PS : Part 4
DesignCourse
7. Home Page HTML & CSS - Part 1
DesignCourse
8. Home Page HTML & CSS - Part 2
DesignCourse
Using Photoshop to Showcase Mobile Projects
DesignCourse
Flat Icon Design Tutorial in Illustrator CC
DesignCourse
Illustrator CC Logo Design Tutorial - A Logo That "Pops"!
DesignCourse
Logo Design Follow Along 1: Emblem Logo Design
DesignCourse
Showcasing Logos in 3D with Blender
DesignCourse
How to Design an Effective Lettermark Logo
DesignCourse
Squeeze Page Design Tutorial in Photoshop (Part 1)
DesignCourse
Squeeze Page Design Tutorial in Photoshop (Part 2)
DesignCourse
Mobile GUI Element Design in Adobe Photoshop CC (Part 1)
DesignCourse
Mobile GUI Element Design in Adobe Photoshop CC (Part 2)
DesignCourse
Flat Mobile App Design in Photoshop CC - Weather App
DesignCourse
Create Reflective 3D Text in Blender (Beginner)
DesignCourse
Animating a Logo with Adobe After Effects CC (Beginner)
DesignCourse
Design a Game Website Mockup in Photoshop CC (Part 1)
DesignCourse
Design a Game Website Mockup in Photoshop CC (Part 2)
DesignCourse
Photo Manipulation Tutorial in Photoshop CC (Beginner)
DesignCourse
Advertising Illustration Tutorial in Photoshop CC
DesignCourse
Perspective Warp Tool Tutorial in Photoshop CC
DesignCourse
Free Giveaway Contest. (WiseBanner Banner Maker).
DesignCourse
Design an Animated Loading/Download Icon (GIF)
DesignCourse
Contest Winners (WiseBanner)
DesignCourse
Model & Animate a 3D Push Button in Blender (Beginner)
DesignCourse
Mega Tutorial - iPhone Breathalyzer - Project Introduction
DesignCourse
Part 1 - iPhone Breathalyzer - Blender
DesignCourse
Part 2 - iPhone Breathalyzer - Rendering & GUI Design
DesignCourse
Part 3 - iPhone Breathalyzer - UI Animation in After Effects
DesignCourse
Part 4 - iPhone Breathalyzer - Website Design in Photoshop CC
DesignCourse
Part 5 - iPhone Breathalyzer - HTML Part 1
DesignCourse
Part 6 - iPhone Breathalyzer - HTML/CSS Part 2
DesignCourse
Part 7 - iPhone Breathalyzer - HTML/CSS Part 3
DesignCourse
Part 7 - iPhone Breathalyzer - Finishing Touches
DesignCourse
Square Space Logo Maker - C'mon People.
DesignCourse
Design a Bloody Knife in Photoshop CC
DesignCourse
Typographic Poster Design Tutorial in Illustrator (Part 1)
DesignCourse
Typographic Poster Design Tutorial in Illustrator (Part 2)
DesignCourse
Modern Business Card Design in Illustrator CC (Part 1)
DesignCourse
Modern Business Card Design in Illustrator CC (Part 2)
DesignCourse
Parallax Tutorial using Parallax.JS
DesignCourse
Interview: Andrew Price of BlenderGuru.com
DesignCourse
More on: UI Design
View skill →Related Reads
📰
📰
📰
📰
The Enter key that submits your form while a Japanese user is still typing
Dev.to · greymoth
The two-Reacts bug: when packages aren't singletons
Dev.to · r9v
🚀 Introducing Prism Guard — An Open Source Frontend Architecture Intelligence Platform
Dev.to · Ritumoni Sarma
The Death of the Heavy Hydration Layer
Dev.to · Amodit Jha
Chapters (3)
Intro
0:33
HTML
3:05
CSS
🎓
Tutor Explanation
DeepCamp AI