Тёмный

Pure CSS Hamburger Menu & Overlay 

Traversy Media
Подписаться 2,3 млн
Просмотров 399 тыс.
50% 1

In this video we will create a landing page with a pure CSS responsive hamburger menu (No JavaScript) with a bit of animation using CSS transitions.
CSS Starts - 6:27
Menu CSS Starts - 15:40
Sponsor: Freelancer Bundle (Use "brad25" for 25% off)
studywebdevelo...
Code:
codepen.io/bra...
💖 Become a Patron: Show support & get perks!
/ traversymedia
Modern HTML & CSS From The Beginning:
www.udemy.com/...
Follow Traversy Media:
/ traversymedia
/ traversymedia
/ traversymedia

Опубликовано:

 

1 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 425   
@cleancodez
@cleancodez 5 лет назад
every body is first Thanks brad....genius as always...
@smokinghot5373
@smokinghot5373 5 лет назад
You helped me a lot. I was able to create and manage my own website. Thanks to you, man. Have a great day whoever is reading this.
@cleancodez
@cleancodez 5 лет назад
hi smoking....):
@MounirBoukhiber226
@MounirBoukhiber226 5 лет назад
From udemy course 😂😂✌ keep going brother 💓💓
@filiporkowski
@filiporkowski 5 лет назад
Me: I already know how to do it. Also me: watches the entire add before the video, leaves a like, lets video play in the background to ensure Brad will get paid.
@EdmundAlynJones
@EdmundAlynJones 4 года назад
Is that how it works?
@impyworm115
@impyworm115 4 года назад
@@EdmundAlynJones yeah, the user's gotta watch an ad or watch the video for a certain time i think not sure
@martinkarugaba
@martinkarugaba 4 года назад
Thank you so much Brad for an awesome tutorial. I have a question. How do I get the menu to disappear after I click one of the menu items?
@Digital963
@Digital963 5 лет назад
It would be helpful if you could split the windows in VS code so that we could see what HTML elements you are targeting in your styles. This would be helpful for those like me who aren't necessary writing it down line by line but more following along visually as a way to compare and understand your approach and it makes for a more efficient way of way of studying the content without taking away from those who need to follow along line by line. Thanks.
@jimohyusuf8115
@jimohyusuf8115 2 года назад
Exactly
@BlackWooDS91
@BlackWooDS91 4 года назад
Hi, sorry but when you click on a menu item, it remains open, how do you close it?
@patriciacostalonga5282
@patriciacostalonga5282 4 года назад
Amazing tutorial
@tryfanevans7047
@tryfanevans7047 4 года назад
Just as I started thinking I was beginning to master css... then I see this video and find how much more there is to know. Thanks for keeping me humble.
@AKagNA
@AKagNA 4 года назад
yeah right
@sarahcharity5750
@sarahcharity5750 4 года назад
Thank you so much! This is definitely going to help me 'wow' my professor for my final project this semester!
@RobertScottPhoto1987
@RobertScottPhoto1987 3 года назад
I know this video is a couple of years old, I have just one question. Once a link has been clicked, is there any way of making the menu disappear using just CSS or would JS have to come into play?
@CODINGISEASY
@CODINGISEASY 5 лет назад
*crazy that you can do that with just css!*
@republicgamer6998
@republicgamer6998 4 года назад
css can do anything it's just bootstrap make life easy xD
@sushilkumarlohani6709
@sushilkumarlohani6709 3 года назад
CSS is made for This bro I can make Advanced Web Illustration with CSS I recommend to Check out the Channel 'Online Tutorial', for THE most amazing speechless Web Illustration
@Digital963
@Digital963 3 года назад
Yep! Beautiful isn’t it? It’s possible to do it just with css, in this case at least, because of the checkbox input. The entire menu relies on that. Brad’s cleverness really shows when he added padding to the hamburger container. That way you didn’t have to guess where to click to get it to work because with enough padding you can click anywhere on the hamburger. Good shit Brad! “Now get me those kha-kis so I can get warm it up. It’s freezin out heaa!”
@BearRilla33
@BearRilla33 4 года назад
Is there a way to have this same hamburger menu and effect where the input/ code is WCAG compliant?
@kitlogan1081
@kitlogan1081 3 года назад
Hi Brad, thanks for this, very useful. I'm trying to get the menu to disappear again when one of the menu items is pressed. The links I'm using are navigating to sections on the same html page, so the page navigates correctly under the menu, but the menu stays visible when it should disappear on tap. Any suggestions?
@sajmon_sweeden
@sajmon_sweeden Год назад
same problem here..
@TomisaburoRMizugawa
@TomisaburoRMizugawa 5 лет назад
Very nice, thanks an awful lot - I've managed to incorporate this into my layout. Now how do I make the menu disappear when I click on one of the links?
@KuldeepSolankiYT
@KuldeepSolankiYT 5 лет назад
one of the best instructor I've ever seen! Thanks Brad for giving us this quality content!
@mascatrails661
@mascatrails661 3 года назад
Wow, fantastic! Coded along with you again and love how this turned out. Such a creative solution to use the check box and its checked state to control the visibility of the menu
@kristjan84
@kristjan84 4 года назад
Which color theme are you using?
@charlotte.upandaway
@charlotte.upandaway 4 года назад
This is incredible! Thank you so much for such a high quality tutorial. I've followed along and made my own hamburger menu and am absolutely thrilled with it! Liked and subscribed!
@mf-11111
@mf-11111 2 года назад
Thanks you Crack!! That's Awesome CSS!
@techxpertpcs
@techxpertpcs 5 лет назад
this is a nice tutorial but i have a question, Im making a one page website and have id's on the section but when i click the nav links its goes to that section but the menu overlay stays there, how do i overcome this issue to make the menu disappear when nav link is clicked
@tebogotau
@tebogotau 5 лет назад
I did this on my react app and having the same issue
@bulldog2024
@bulldog2024 4 года назад
@@tebogotau I used this on my react app and figured out how to handle it. I'm using react-router-dom. I created a function called handleClick and in that function, just put document.getElementById("checkbox").click(). That will change the checked state. Just give your checkbox an id of checkbox. In you links, check call onClick={handleClick}
@RKkuba
@RKkuba 5 лет назад
How can I make the menu scroll to section and then disappear after a click?
@stylaxz
@stylaxz 3 года назад
Hello, I know it's been a long time but did you find the solution?
@ZXchrisX
@ZXchrisX 5 лет назад
Excellent video man you have definitely helped me develop! One thing though, the page background overlay color appears for a split second when my page is loading. Is there any way to fix this?
@ebbasund7599
@ebbasund7599 4 года назад
Awesome! Is there any way to close the menu once a link has been clicked, please?
@Filosopha
@Filosopha 4 года назад
shouldn't it take you to a different page that will load a fresh without the menu once you click?
@mochkal
@mochkal 5 лет назад
anyone has problems on responsive view on IOS/iphone? android withouth issues, but on iphone can only see the header row ...
@parikik
@parikik 4 года назад
Also have the same problem. Doesn't work on Apple devices. The hamburger X animation works, but the menu doesn't show up.
@MrVitya77
@MrVitya77 4 года назад
bumped into a problem here.... when you use this menu on a landing page where you use links to scroll to some anchor it stays opened =(
@MrVitya77
@MrVitya77 4 года назад
for (let i = 1; i div > div.menu-wrap > div.menu > div > div > ul > li:nth-child(${i}) > a`).addEventListener('click', () => { document.querySelector('.menu-wrap .toggler').checked = false; }) }
@evankapantais5300
@evankapantais5300 5 лет назад
Also, isn't it more taxing on the browser resources to target elements many levels down the inheritance tree than to add classes to the elements?
@DebjitMajumdar
@DebjitMajumdar 5 лет назад
I want to know this too. Is it good to add a plethora of classes or use advanced selections?
@ac695
@ac695 2 года назад
Awesome!! I love the fact that you give a rationale for each css property that you decide to go with. Super-helpful.
@DrinkCola
@DrinkCola 4 года назад
does it work in all browsers? especially Internet explorer 9 & 10.
@JohnBartmannMusic
@JohnBartmannMusic 3 года назад
Help! Struggling to make the animated menu overlay disappear when the links are clicked. Currently seems to be necessary to click the X in order to return to the background content.
@tijani3141
@tijani3141 5 лет назад
This is from your udemy course, love it man
@leon1985ist
@leon1985ist 5 лет назад
22:21 won't work for me please help , I do it same way but nothing happened
@connornuggets5450
@connornuggets5450 4 года назад
Exactly I am unable to clicked on the menu!!
@philly_Will
@philly_Will 2 года назад
Hello Brad, I purchased a few of your courses from UDEMY starting in 2018. Coding is a hobby of mine, but I made and maintain a website for our local KofC council. I cannot find this hamburger menu lesson in your "HTML & CSS FROM THE BEGGINING." Can you tell me which lesson it is in? Thanks
@chethanbhat
@chethanbhat 5 лет назад
Traversy Bhaayya Zindabad 😍✊
@bhfaught
@bhfaught 5 лет назад
Just signed up for your HTML, CSS, & SASS course on udemy. Needed a modern refresher with grid, flexbox & sass!
@widheg
@widheg 2 года назад
Great hamburger menu -- with no (need for) JavaScript. I noticed something though that I suspect is unintentional: The tag is not closed.
@CaneKostovski
@CaneKostovski 8 месяцев назад
Help Me: My list of links are right aligned and I can't seem to get them centered. Example: Home
@lolypop185
@lolypop185 4 года назад
Only issue was not being able to inspect anything within the showcase (main-body) class because the menu and menu-wrap classes are positioned above them. Solved this by simply adding this to the css and can now inspect everything below the nav menu header: .menu-wrap, .menu { height:60px; } Loved this workaround though!
@ryanmossaway970
@ryanmossaway970 4 года назад
I thought about it for a while ... and I don't know why you're using forEach to set up event listeners on every delete button. Would it not be better to set up a listener for the list, then evaluate if that list contains a 'delete' class, perhaps? If it does, then preform a delete on that row. What if I had 100,000 books? Setting up an event listener on EACH & EVERY delete button would be insane. Am I wrong? Plz give the comment a thumbs up if I'm right. Thumbs down (and hopefully some constructive feedback) if not. Thanks.
@shnam928
@shnam928 5 лет назад
Thank you Brad, NativeScript & vue plz.
@raghul7211
@raghul7211 5 лет назад
Super cool as always
@blrichwine1
@blrichwine1 2 года назад
It'd be cool if you could do this and it was coded according to accessibility standards. An unlabeled checkbox? No focus management? Not describing that the hamburger menu is a menu dropdown and not accessibly (programmatically) indicating state (expanded / collapsed)? Sigh....
@Ferdam
@Ferdam 4 года назад
First of all, amazing video! I tried to implement this css/html only visibility toggle method but I just failed. Gave up and went for an easy and quick JS solution. Anyway, I'm sure I'll get how that works someday. Still useful for the hamburger icon using pseudos (after/before). Gr8 stuff man
@bryanhooper4096
@bryanhooper4096 4 года назад
Great video! I implemented the menu, but how to close the menu once a link has been clicked?
@bonoke50
@bonoke50 4 года назад
same issue
@davescorneroftheworld1147
@davescorneroftheworld1147 4 года назад
In the HTML document simply rename the "LINKS" for other pages. Like the: Home About Services Contact
@thedigitallabco
@thedigitallabco 4 года назад
@@davescorneroftheworld1147 But what if its a one page website and those links scroll down to a different div? For me its still visible after I am taken to the right div
@joffreymatute2203
@joffreymatute2203 2 года назад
Did you find a solution for this? Thanks
@curtismaple
@curtismaple 4 года назад
Great video! But it’s quit some work for just a hamburger menu .. 🤔😐 Isn’t there a easier way? Thnx Brad👍🏼👍🏼
@mihaicosminmavrodin831
@mihaicosminmavrodin831 3 года назад
Hey, Brad! Can you help me a bit, please? I am using Angular in a project and I have created a nice burger menu following your video. I use routerLink to navigate to different links in the menu, but how can I make my burger menu dissappear upon clicking a link? I have tried different solutions but none of them worked. Thanks!
@HossamKhalaf-sr1oo
@HossamKhalaf-sr1oo 5 лет назад
and the oscar of best developer and teacher ever goes to 'Brad Traversery' love from Egypt ..
@IMMarketingGoddess
@IMMarketingGoddess 3 года назад
All this does is print words on my page. There is no hamburger. Will someone please advise?
@adrian_vsk7203
@adrian_vsk7203 3 года назад
Loved the video. But I'm having a problem that the z-index of the toggler means I can't click on the "Read More" button. If I change that z-index then the button shows through the menu. Any idea how to solve this?
@KhiavDim
@KhiavDim 5 лет назад
How do I close the menu after I click a link?
@wilsonesmundo5812
@wilsonesmundo5812 4 года назад
@Coyotewolf10// what do u mean?
@fowcc
@fowcc 3 года назад
Quick question- is there any way to have the background image stay in place if the page scrolls down? Everything looks great but I guess because the position is absolute to top 0 left 0, if I have a page where content goes below the window, when I scroll the bg image scrolls away and the gray (from primary color) fills in the background space then.
@21Dimen
@21Dimen Год назад
Great tutorial! Thank you. By the way, I wonder are the clickable? I made a burger menu by watching this video but they're not even selectable as if you wanted to select text.
@topeleye
@topeleye 3 года назад
When the Navbar List items are clicked. The Navbar and Overlay remains. Please How do I remove the Navbar and Overlay when the Navbar list items are clicked. Thank you
@johannesandersson2428
@johannesandersson2428 4 года назад
Can anyone help me? When i press the hamburger menu i get the effect and menu to ease in. But when i click the hamburger again to close the menu, it does'nt "ease out"? It's just closing straight up. Otherwise, best tutorial on youtube :) @traversymedia
@soondar3187
@soondar3187 3 года назад
Checkout this playlist you will find almost every type of navbar ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-06UtXZo78ng.html
@koenraijer7596
@koenraijer7596 3 года назад
Hi guys, quick question. I've integrated this design so that it appears only at a smaller screen size. When I scroll the hamburger behaves like a sticky element, even though all the position is fixed.. Does anyone know the solution?
@clmb2225
@clmb2225 3 года назад
Thank you for the very informative video. I have learned a lot. What can I do to after pressing the about left, for example, the menu disappears again? And I jump to the for example on in the About section?
@sgr2683
@sgr2683 3 года назад
I wasn't getting any good video on overlay! But this video solved that problem to😊 Thankyou so much:D
@tokoavaliani6509
@tokoavaliani6509 4 года назад
hello. I was just using this technique for a personal website I am making. I wanted to include a link in the "showcase-inner" div but because the showcase height is set to 100vh I can't access it. Do you have any suggestions to help me get around this? Thanks
@shehrozamin9543
@shehrozamin9543 2 года назад
Jazaak Allah Khair for such an informative video.
@confluenceinfinitethemovem
@confluenceinfinitethemovem 4 года назад
If you click into the menu, click a page link, then click the browser back button, the menu with page links displays. How can I fix this?
@texxs01
@texxs01 4 года назад
Line 44: Why can't we just use .showcase-inner? I can't think of even a future case where we use the showcase-inner class outside of a div with the class of showcase and if we did, wouldn't/shouldn't we want/expect it to work mostly the same way?
@ernestukut2767
@ernestukut2767 9 месяцев назад
Now here's a master class! Thanks Brad❤️
@gulay3203
@gulay3203 4 года назад
if you don't explain any tut, i don't understand anything..(i watched same thing from other channel) thank you:)
@widheg
@widheg 2 года назад
Why are there *two* (child and grand-child) inside the ?
@ralphmagat6818
@ralphmagat6818 4 года назад
Hey brad just thinking if you have the chance to read this. Just want to ask, i am using sublime text 3 and in the part of accessing the div inside the class hamburger it is not working. I try different methods but still doesnt work. Just taking a chance if you can read this. Thank you 😁
@karena992
@karena992 4 года назад
Hi, great tutorial, but I couldn't get checked:hover to work. Anyone?
@topeleye
@topeleye 3 года назад
When the Navbar List items are clicked. The Overlay remains. Please How do I remove the overlay when the Navbar list items are clicked.
@mahmoudhassen4463
@mahmoudhassen4463 5 лет назад
Extremely useful lesson, I've learned a lot about creating a hamburger menu, transitions, animation and buncha other stuff. Thank u so much brad, sending love from Egypt!
@DavidBoutin
@DavidBoutin 2 года назад
Dude, I am learning SOOO much just by following along with your tutorials! Thanks for all these. I'll get one of your Udemy's courses really soon, probably that 50 projects in 50 days one.
@ninpasker3223
@ninpasker3223 2 года назад
Awesome video super helpful even after 3 years of creating this content, I was easily able to implement this code with sass.
@byui-masa
@byui-masa 4 года назад
How cool!! From 20-year-old Japanese...
@kenzielove8754
@kenzielove8754 4 года назад
My checkbox isnt inline with my hamburger nav lines? Is there anyway to fix this?
@paulg.3067
@paulg.3067 3 года назад
My problem is the checkbox is not centered inside the hamburger box, its aligned top left.
@jenovacells
@jenovacells 3 года назад
Is there a way to close the menu when one of the links are clicked? I am trying to use the checkbox for a hamburger menu but my links remain open and cover the section they point to. None of the videos I watched cover the solution to this problem is having
@miguelaceves5738
@miguelaceves5738 2 года назад
It is really impressive but... I am too newbie and I dunno how to make this responsive... :(
@Daniel-ij2xy
@Daniel-ij2xy 2 года назад
Thanks! Aweasome tutorial
@Kate-is5mz
@Kate-is5mz 4 года назад
Hey, how do you get the menu to close after you click on a link within it? I followed the steps in the video and everything works perfect except the part where you click on the link and the menu still sits there on the screen :D
@bonoke50
@bonoke50 4 года назад
same issue
@Kate-is5mz
@Kate-is5mz 4 года назад
@@bonoke50 Hey, I fixed my problem, but I used a Js function to uncheck the checkbox when a link is clicked (added an event listener for this). Just google it, that always works. :'D
@bonoke50
@bonoke50 4 года назад
@@Kate-is5mz thnx!! I'll look into it now!
@bonoke50
@bonoke50 4 года назад
@@Kate-is5mz Could you please show me what you did? I'm working with Angular for my project and i'm getting so confused bc regular JS works different in Angular. If i see the correct code for this situation i think i'll be able to translate it to Angular, Please, you would really help me out
@Kate-is5mz
@Kate-is5mz 4 года назад
@@bonoke50 Hey, I've just seen this reply. No problem dude, I'll be happy to help, I also just realized that I gave you the wrong answer xD I used JQuery and this code: $(document).ready(function() { $(".link").click(function(){ $(".toggler").prop("checked", false); }); }); I gave all my links the .link class - hope this help, I'm a noob so I can't even explain properly :'D
@mikersson
@mikersson Год назад
Nice! I will make this one that looks really nice. Thank you for sharing!
@raghavgupta3168
@raghavgupta3168 5 лет назад
A very big thanks🙏 for the Copious amount of knowledge you are giving to us. Lots of love from India.🙏
@MaAlejaGaitan3D
@MaAlejaGaitan3D 4 года назад
Gracias Brad!! I love the way that you explains. I'm doing your course modern html css from the beginning. It's awesome!! Sorry for my english =)
@디자인업
@디자인업 4 года назад
보통 햄버거메뉴릏 구현하기 위해서는 자바스크립트를 사용하는데요. 이 영상에서는 체크박스와 css 를 활용하여 부족함 없이 잘 구현해낸 영상입니다.
@FernWerk
@FernWerk 3 года назад
What if we want the circle to disappear when we click on another link? Right now you have to click the link and then X out of the menu. How would you get the links to do that for you?
@quiztherapy6851
@quiztherapy6851 2 года назад
i am following along. What can be the reason that my checkbox has not gone with opacity 0? thank you.
@speed-cn614
@speed-cn614 2 года назад
Thank you very much for helpfull content. Have a nice day :)
@mr.webdev3700
@mr.webdev3700 5 лет назад
Thanks Brad! Amazing as always!
@tarasmatsievskyy709
@tarasmatsievskyy709 5 лет назад
1)Thanks for great tutorial 2)Can we hide this menu and transform checkbox when click on links?)
@TomisaburoRMizugawa
@TomisaburoRMizugawa 5 лет назад
Methinks not without some Javascript ...
@JamesBeake
@JamesBeake 4 года назад
....and for this reason these "css only" nav videos, and there are a lot of them out there, are nothing but click-bait.
@tintin537
@tintin537 5 лет назад
0,4 😅
@UnknownUser-ts1sw
@UnknownUser-ts1sw 3 года назад
deymm the degree is complicated, one wrong value of degree could ruin the X position
@architadh.2727
@architadh.2727 4 года назад
Why not just put these styling in .container itself, rather than creating a new class? After all both the classes target the same div? 12:25
@Smackindaface
@Smackindaface 4 года назад
This does not work in iphone ios fyi. It will on codepen but that is due to it being emulated. If the browser is running the code it will not work.
@qplate628
@qplate628 4 года назад
OMG! This is so Complicated, I hope you make another Video on this, Thanks for Your Efforts, You Are The BEST!
@mathguy3801
@mathguy3801 5 лет назад
Great work! Can you consider doing a video in which you show and discuss your Mac OS environment for development including hardware and software? Thanks!
@KimliangMich
@KimliangMich 4 года назад
So how about this tutorial: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-dUPzppbfwWI.html
@UniqueBots
@UniqueBots 4 года назад
Where is the menu button it's just there but gone like invisible or something??
@plugincraft
@plugincraft 3 года назад
This is great, is there a wy to move the checkbox to the gith togheter with everything?
@Sar3n7
@Sar3n7 4 года назад
why is input tag so fucking weird? its like a little javascript window
@EdmundAlynJones
@EdmundAlynJones 4 года назад
This is a great tutorial. I love the aesthetic. I know this isn’t Stack Overflow but... ...when I applied this nav display to my portfolio it “covers” all interactive content on my portfolio even though it is not visible. Any tips to keep this design along with regular button function on the rest of my page.
@mattviverette
@mattviverette 2 года назад
I was having this problem and I realized I had a typo in my CSS. Check your menu.css for the style targetting ".menu-wrap .menu".
@maggus1058
@maggus1058 Год назад
Can you specify what materials were used? Im new to arduino so i cant identity all of that
@connornuggets5450
@connornuggets5450 4 года назад
I am unable to click on the menu button therefore no rotation nothing! Is there anyone with same problem??
Далее
Full Screen Video Background - HTML & CSS
17:52
Просмотров 109 тыс.
Iran launches wave of missiles at Israel
00:43
Просмотров 556 тыс.
How To Build An Animated Hamburger Menu With Only CSS
24:05
Responsive HTML & CSS Side Menu From Scratch
23:57
Просмотров 397 тыс.
HTML Crash Course For Absolute Beginners
1:00:42
Просмотров 7 млн
The problems with viewport units
13:23
Просмотров 362 тыс.
SpaceX Website Clone - HTML, CSS & JavaScript
2:13:53
Просмотров 93 тыс.
7 ways to deal with CSS
6:23
Просмотров 1,1 млн
Learn CSS Flexbox in 20 Minutes (Course)
20:37
Просмотров 138 тыс.
Basic, Intermediate & Pro animated hamburger icons
59:41
Responsive Pure CSS Menu Tutorial (No Javascript)
43:13
The Easiest Way to Build Websites
10:56
Просмотров 504 тыс.
Iran launches wave of missiles at Israel
00:43
Просмотров 556 тыс.