Тёмный

How to Create a Dynamic Centered Logo Menu in Bricks (w/ SCSS) 

Kevin Geary
Подписаться 19 тыс.
Просмотров 6 тыс.
50% 1

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

 

26 окт 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 125   
@VerbiVeritatis
@VerbiVeritatis 2 года назад
Ha! Love the Terry cameo! The tutorial was great. I love walking through the theory. You’re a fantastic teacher
@Gearyco
@Gearyco 2 года назад
Thx!
@kolsongar
@kolsongar 2 года назад
This taught me about SCSS in less than an hour than a full on course I am doing on Udemy. Great work as usual Kevin. Keep it up!!!!!.
@techfairyrina
@techfairyrina 2 года назад
yeap, same here :)
@rubengarciajr
@rubengarciajr Год назад
Have you joined the inner circle ⭕️
@mikkey0001
@mikkey0001 2 года назад
This hit the sweet spot for me. I know basic CSS, this opened my eyes to new possibilities. More please Kevin
@davidwalls2304
@davidwalls2304 Год назад
Kevin, I watched this video when you first posted but came back to watch a second time. Although my client's websites generally do not add/subtract pages, this approach is definitely a more streamlined approach. Keep up the SCSS videos, they are greatly valued!
@andrebaum9248
@andrebaum9248 2 года назад
Slowly starting to not feel like a chump anymore. Your videos introduce advanced concepts of CSS understandable for beginners, which is very valuable. None of the "you got to learn all the basics (basically chump-ways) first so then after that you can learn how to intelligently dump the basics" bs.
@bluefuzecom
@bluefuzecom 2 года назад
You were extra "SASSY" in this video. Love it.
@anaf4072
@anaf4072 2 года назад
Thanks! YES, it did help. Yes, it made perfect sense. Yes, it's absolutely worth a bit of extra time to do it right. It can safe enormous amount of time troubleshooting/adjusting. Tutorials like this one are the top notch. More, please.
@firozfaizan
@firozfaizan 2 года назад
First time I feel confident to use SCSS. Your content rocks.
@digitalrefreshmkt
@digitalrefreshmkt 2 года назад
Every video you make continues to blow us away. Loving all of these 'chump' examples and killer SCSS domination.
@AndyTate-1
@AndyTate-1 2 года назад
Many thanks for this Kevin. Slowly getting to grips with Bricks Builder and all your associated systems. I do have to play you at 0.75 speed as you are a quick talker. Maybe it;s me that is getting older😁!!! Keep up the good work!!!!!!!!!
@prokopko
@prokopko 2 года назад
This is what I like on Sass, and your Tutorials are always with so much value!
@FernandoArbex
@FernandoArbex 2 года назад
You're just elevate our game to the next level. This a serious professionalism. Thank you for the video.
@marcorunsyay
@marcorunsyay 2 года назад
Another fantastic video Kevin, thank you. I appreciate the extra mile, making it really scalable and future-proof. The only way to go, really.
@ReubenHochstetler
@ReubenHochstetler 2 года назад
Love this tutorial. I don’t like logo centered menus but learning these SCSS techniques is incredible.
@Gearyco
@Gearyco 2 года назад
Me either
@nick90000
@nick90000 Год назад
great tutorial, makes it easy to jump into something I've been putting off learning, SCSS in this case👍
@mrianforest
@mrianforest Год назад
This is a FANTASTIC tutorial and one I've just followed. Someone mentioned below about adding a new SCSS variable for the menu items instead of using data attributes and the mixin, so I did that and all is good. Someone else below also mentioned that the menu will always look off-centre because the number of characters in the menu options to the left and right of the logo are not equal so the trick here is to make each the same width as the longest menu option. Just have to work out how to do that now! But THANK YOU for this tutorial...!
@mrianforest
@mrianforest Год назад
ok figured it out, reasonably easy... replace the gap: 2em; in the UL with this... display: flex; justify-content: space-between; then add... ul li a { display: block; width: 150px; (or wider than your biggest menu option) padding: 5px 5px; text-align: center; } I've not checked to see how this degrades so I could be a right chump here, willing to take my chances...!
@richardc1925
@richardc1925 Год назад
Kevin excellent video!! I learned a lot of useful information! Once again you blow me away with outstanding content! Thank you!
@geckografix
@geckografix 2 года назад
Fantastic and absolutely doable for Oxygen users
@filippoponzetti
@filippoponzetti 2 года назад
Absolutely brilliant! Thanks Kevin.
@noraholmquist8231
@noraholmquist8231 2 года назад
Excellent video, both the approach and pace worked well for me.
@pixaful4113
@pixaful4113 Год назад
And you called me a chump! Guilty as charged! But seriously though, good lesson! learned alot! I have been using basic Sass for some time, never used a mixin until today. This will change the way I look at Sass and will certainly get more involved in it!
@DesignwithCracka
@DesignwithCracka 2 года назад
Great video Kevin! You definitely solved one of two challenges ( i.e. the dynamic logo width/margin values) present in one of my videos that addresses the same topic. The second challenge I've experienced in using absolute positioning is how to handle menu items on one side of the split having more characters, since the logo is taken out of the document flow, the text tends to overlap it. It appears there's no way to tackle this with (S)CSS. I'm looking into a solution with JS, it seems that may be a viable solution to that issue.
@Gearyco
@Gearyco 2 года назад
These centered logo menus have a lot of tradeoffs. They’re a real pain in the ass.
@DesignwithCracka
@DesignwithCracka 2 года назад
@@Gearyco Yeah, nonetheless it was also a great opportunity to learn the magic of SCSS!
@mrianforest
@mrianforest Год назад
I got something close to this with CSS and posted it above however on reflection it's still not 100% correct because the logo is the reference point right? So the menu options to the immediate left and right of the logo need to have the same number of characters in them in order for it to "look" centered. It's not always possible and i'm not sure how to take this forward other than for sites that MUST have a centered logo, to stick the menu options in a hamburger menu. The logo is in the middle, it re-inforces the brand, all good!
@tjveach
@tjveach 2 года назад
A GREAT SET OF EXAMPLES, I learned a ton! Thanks!
@ziggy6443
@ziggy6443 Год назад
Gracias Kevin! Very helpful for me, and it's fun to follow your channel . Poor Terry..;)
@Gearyco
@Gearyco Год назад
Terry is a legend!
@interculturalcommunication3889
@interculturalcommunication3889 2 года назад
Incredibly helpful as always. Thanks Kevin.
@HarigopalDasa
@HarigopalDasa 2 года назад
Great tutorial . learnt a ton. Thank you
@marcsmad
@marcsmad 2 года назад
Thank you for all the videos you make, they are very helpful. This has nothing to do with video but do you recommend motion pages? Thank you! 😁
@Gearyco
@Gearyco 2 года назад
I’ve never used it. Animation isn’t that important to helping businesses grow. I focus on higher value design concepts.
@digwillhachi
@digwillhachi 2 года назад
I had this planned in my head how i would do it and i got it right (mostly) 😆So happy, i'll give myself a bonus coffee for reward !
@ranmaron
@ranmaron 2 года назад
Amazing course thank you. More please
@c.s.christopher5801
@c.s.christopher5801 2 года назад
Excellent tutorial!
@PenaTechnologies
@PenaTechnologies 2 года назад
Kevin, thanks so much for this tutorial! Was very interested in the a11y stuff you had. In addition to SCSS stuff, it would be badass if you could do some accessibility training as well. Lord knows many sites completely ignore that aspect.
@Gearyco
@Gearyco 2 года назад
I sprinkle it into trainings here and there. In the inner circle as well we have a whole discussion section and more in depth trainings.
@PenaTechnologies
@PenaTechnologies 2 года назад
@@Gearyco Much love, brother. Will definitely have to join your Inner Circle!
@Gearyco
@Gearyco 2 года назад
@@PenaTechnologies We'd love to have you!
@zac8670
@zac8670 2 года назад
Amazing tutorial. Next step would be to use PHP to dynamically set the data attribute based on the number of links. Quite a fantastic tutorial!
@Gearyco
@Gearyco 2 года назад
Php is above my pay grade for now.
@markthomas8542
@markthomas8542 Год назад
I followed this tutorial and it worked perfectly. One strange thing, however. I have a menu with 6 links and with sub-menus and in the sub-menus, every fourth item is aligned right. What could be causing this?
@Gearyco
@Gearyco Год назад
I’d have to see a link
@abdulwaheedorg
@abdulwaheedorg 9 месяцев назад
It's good but it's still not fully maintainable. How do you suppose to remember to add data attributes after 3 months?
@Gearyco
@Gearyco 9 месяцев назад
Started recommending a JavaScript solution.
@9999chippy
@9999chippy 2 года назад
Great video, learnt a lot, more like this please.
@a1webguy
@a1webguy 9 месяцев назад
Is it possible to create a variable to take the value in [data-menu-links="x"] by calculating the value of last child, and save repeating that segment of code?
@Gearyco
@Gearyco 9 месяцев назад
Not sure what you're asking exactly, but it doesn't sound like it. Not without JS.
@DimitryChamy
@DimitryChamy 2 года назад
Ok, I have a follow-up question I think has not been asked. I know this goes beyond sass but how would use the wp-menu itself to generate the data-attribute value instead of doing it manually?
@Gearyco
@Gearyco 2 года назад
JS
@pandaosa9
@pandaosa9 2 года назад
Just followed along for the 2nd time to make my own. Pretty cool! Do you have any favorite resources to learn more SCSS? Something that I noticed on my end was that if there was a lot of variability in the character lengths of the links, it will not look centered due to the entire menu being centered with the center gap being off-center due to the sides having unequal characters. Does this happen for you too or did I make a mistake somewhere?
@dahunsi
@dahunsi Год назад
I watched this again today and I started wondering if it is possible to have the number of links be dynamically injected into the data attribute. Apologies if this had been asked and answered.
@Gearyco
@Gearyco Год назад
For sure, but there are other issues that would still need to be resolved
@foofourtyone
@foofourtyone Год назад
And with just one line of jQuery (or couple of lines more in vanilla JS) you could make it fully dynamic without having the need to change the data attribute by hand. Nice video
@andreigirban215
@andreigirban215 11 месяцев назад
how
@jiripaulas9347
@jiripaulas9347 Год назад
Great tut! You can also reduce the code by doing a SASS loop: @for $i from 1 through 5 { [data-menu-links="#{$i*2}"] { @include menu-gap($i*2); } } And if you want flexibility for the client so he can only update the menu items in the admin and the other works automatically, you could use php or javascript function to change data attribute. But of course it's out of the scope of this video…
@adventure-007
@adventure-007 Год назад
Interested, do you have the code?
@andreigirban215
@andreigirban215 11 месяцев назад
how
@NicolasHeinen
@NicolasHeinen 2 года назад
Hi Kevin, I don't see any header Frames template with centered logo menu, I guess it's still a work in progress ?
@Gearyco
@Gearyco 2 года назад
Just hasn’t been released yet
@techfairyrina
@techfairyrina 2 года назад
Just GOLD!
@uioverhaul
@uioverhaul 2 года назад
What if the number of menu items will be consisting of odd number, for example 7?
@Nima-Norouzi
@Nima-Norouzi 2 года назад
In this case you can modify the calc count of the codes, but the issue is that the menu on the left and right side are not equal width and don't look good in terms of the design.
@Syphronix
@Syphronix 2 года назад
Add a CTA button to the design so you now have an even number of elements (x | 'logo' | x+1)
@Gearyco
@Gearyco 2 года назад
It won't look great. But if you really want to do it you just follow the same process and add the appropriate child targeting. if you don't want limitations on the number of links in your nav, don't use a centered logo menu. It's a drawback of the concept in general.
@Multilive1000
@Multilive1000 2 года назад
37:40 I do not know why but the link next to the logo on the right side there is more spacing than the link on the left side of the logo. Why is that? And maybe to make it easier is to make a ACF/Metabox field in a options page called "number of links" and than pull that data into the attribute value. You can make that field a dropdown even with: 2,4,6,8 etc to make it easier. Some people do not need builder access so a field is a good option.
@Gearyco
@Gearyco 2 года назад
There’s a lot of ways to do it.
@LastKingOfAtlantis
@LastKingOfAtlantis 2 года назад
​@@Gearyco Is there a way within the native WordPress system and/or SCSS that it could automatically count the links within the menu, rather than needing to do it manually? If there there is and is has a name I'm happy to go and research it myself, I'd just need to have a rough idea of what I would be looking for :D Thanks!
@Gearyco
@Gearyco 2 года назад
@@LastKingOfAtlantis No, but it can probably be done with JS.
@DejvDesign
@DejvDesign 2 года назад
Hello, why did you start using bricks instead of oxygen builder? Is there some advantages?
@Gearyco
@Gearyco 2 года назад
Oxygen is dead.
@DejvDesign
@DejvDesign 2 года назад
@@Gearyco Why do you think that?
@Gearyco
@Gearyco 2 года назад
@@DejvDesign a few different reasons.
@chrisfoti1123
@chrisfoti1123 2 года назад
Extremely Helpful, Thank you! Back it up, Terry. LOL!
@zaitx
@zaitx 2 года назад
I think if you don't change menu often. Center menus are often build once. Simple solution is to add left and right menus and mobile menu to wordpress and position them.
@haroonqraja
@haroonqraja 11 месяцев назад
Since the logo is usually a link to the home page, why not just add it to the nav in the middle as an img tag, give it the alt text of 'Home' and a class, and then style it using that class?
@Gearyco
@Gearyco 11 месяцев назад
Then it’ll disappear when you hide the desktop menu. And it still doesn’t solve any of the issues with a centered logo.
@superoverdrive8628
@superoverdrive8628 2 года назад
Great video Kevin! Regarding Bricks, if we are talking facts here, are the code output resulting in a noticable faster site than Oxygen would deliver? Given that they have removal of id's and classes not in use along with overall clean html etc..
@Gearyco
@Gearyco 2 года назад
About the same.
@ocbroadband
@ocbroadband 2 года назад
This is F'n gold.😁
@mk-design
@mk-design Год назад
Hey Kevin :) A similar template doesn't exist in Frames - or have I been missing something? Right now there's 4 Header templates, but the one most similar has the Logo sitting on top of the menu bar. I'd be very happy to have exactly THAT template you explain here in the Frames templates :)
@Gearyco
@Gearyco Год назад
We removed it because it is quite technical and requires the user to understand a lot about how it works. Therefore, it is somewhat breakable. We are trying to come up with a more beginner friendly implementation.
@mk-design
@mk-design Год назад
@@Gearyco Maybe it would help to offer a "Expert mode" so we could have extensive templates, too... The basic templates are somehow .... very basic
@Gearyco
@Gearyco Год назад
@@mk-design because the basics cover 95% of needs when building sites. It’s your job to spice them up when you design them. And they’re not as basic as they seem when you look under the hood. But if you have any examples you want us to build we are more than happy to if they make sense. Just submit them to us in the group.
@trevlb
@trevlb 2 года назад
Really enjoyed the deeper dive with SCSS. I wonder if a php function could be written that would write a SCSS variable based on the number of menu items, and get triggered any time the save menu button is pressed?
@Gearyco
@Gearyco 2 года назад
Maybe. I’m not a php developer tho.
@Tom-Homer
@Tom-Homer 2 года назад
@@Gearyco Not sure if the trade off would be worth it as it is more to maintain and their still is limitations like having an even number of menu items. Saying that... I wonder if a shortcode would work if you added it as the value for the data attribute in bricks... You can create a short code snippet in WPCodebox and add some code like: (which I assume works as I found it by Googling and have not tested it) // Get menu object $my_menu = wp_get_nav_menu_object( 'your-menu-name-or-slug' ); // Echo count of items in menu echo $my_menu->count;
@AmandaLucaseu
@AmandaLucaseu 2 года назад
This was awesome!! Thank you for walking us through it. With wp Codebox, do you save this as a cloud snippet so you can easily pull this in when building a site with centred logo.
@Gearyco
@Gearyco 2 года назад
You definitely could! Or … just use frames since it’s going to be in the next round of frames updates.
@Tom-Homer
@Tom-Homer 2 года назад
@@Gearyco I guess Frames will need a description for some templates to explain the limitations (ie even # of menu items) and basics of what the data attribute is for
@AmandaLucaseu
@AmandaLucaseu 2 года назад
@@Gearyco doh 🫣 of course
@Gearyco
@Gearyco 2 года назад
@@Tom-Homer yes planning on adding documentation for certain frames.
@Nima-Norouzi
@Nima-Norouzi 2 года назад
Thanks again for this amazing tutorials 🙏 I know this would be a silly question, but is there a way to dynamically count the number of the menu links somehow? Instead of manually writing the number in the attribute part?
@Gearyco
@Gearyco 2 года назад
Not that I know of. Anything is possible, I'm sure, but that doesn't mean it's practical and implementable my most people.
@michaelvandinther
@michaelvandinther Год назад
Nice! Make the data attribute dynamic 🙂
@stripedgoat
@stripedgoat 2 года назад
Fantastic tutorial! I’m not good with math-based thinking (my brain started to heat up at the mixin part 🤣), but this was still relatively easy to follow even for me. One question I always had but never asked you thus far: I see you don’t shy away from using position: absolute whenever needed. Is that still considered a good practice? Is using position:absolute something to avoid whenever possible - in general terms? I was just working on a nested slider, and since I wanted to utilize srcset, instead of using background-image, I went with placing in an actual image, positioned aboslutely, and on top of that another div all over it (for overlay) z-indexed above, AND on top of that, the container with text. Is that a good way to do it? 😃 Thanks! 👊🏼
@Gearyco
@Gearyco 2 года назад
Yeah nothing wrong with absolute positioning. It’s a valuable technique.
@stripedgoat
@stripedgoat 2 года назад
@@Gearyco That's great to hear! Thanks for your reply! ✌🏼
3 месяца назад
I read the description where you wrote it is included in Frames ─ But it is not.
@Gearyco
@Gearyco 3 месяца назад
We removed because it’s too difficult for most users to manage properly
@andrew.schaeffer4032
@andrew.schaeffer4032 2 года назад
That's slick man. I'm betting you know how to loop those links so you don't need to manually enter the number when you add more links ;)
@Gearyco
@Gearyco 2 года назад
Do you know something I don’t?
@andrew.schaeffer4032
@andrew.schaeffer4032 2 года назад
@@Gearyco maybe it's only possible in js then? Coulda sworn scss could do something like that
@Tom-Homer
@Tom-Homer 2 года назад
@@andrew.schaeffer4032 No SCSS like CSS doesn't have access to the html so the only way would be JS unless you inline the css or update the data attribute using php when the page is requested
@HEYVIET
@HEYVIET 2 года назад
Why not just add the logo as a menu item and add a class to it that way? Seems like it’d be a quicker method to center your logo in the menu items. No SCSS or other complexities needed?
@Gearyco
@Gearyco 2 года назад
There are many ways to accomplish the same thing. each with different pros and cons. technically, the logo is not part of the NAV. and when you put it in the wordpress menu, you are making it part of the navigation. So there is a potential argument about semantic accuracy and accessibility there.
@serhiididenko
@serhiididenko 10 месяцев назад
🔥🔥🔥🔥🔥🔥
@kappesante
@kappesante 2 года назад
we all love you. you know that, ye?
@Gearyco
@Gearyco 2 года назад
🙏
@kappesante
@kappesante 2 года назад
@@Gearyco i mean, the amount of value here is damn high. and funny as hell. dunno how many people can find coding fun, i hated it for 20 years enjoying the only graphical aspect of my job, and now it’s funny. great teacher.
@brunopapas
@brunopapas Год назад
@@kappesante same here 🤯....getting so much fun learning things!!!
@TheCredibleHulk
@TheCredibleHulk Год назад
I think the mixin and data attribute were both an overkill, and, in the end, result in a lot of completely redundant CSS being generated. You already saved logo width as a SCSS variable (meaning you’d have to edit the SCSS to modify it), then why not also create a variable for menu items count, e.g “$links-count: 4;”? Then simply extrapolate the SCSS “:nth-child(#{$links-count / 2 + 1})” and “:nth-child(#{$links-count / 2})” and you are done. If you ever change the number of menu items, simply edit that SCSS variable and you are done. As a result - you have CSS that contains EXACTLY what you need. Nothing less, nothing more. Instead of what it is right now - bunch of unused, mostly duplicated CSS lines just to potentially cover other scenarios. AND you also have to deal with some additional data attribute in Bricks, which doesn’t pass the “3m rule” in my books.
@Gearyco
@Gearyco Год назад
Thanks for your thoughts
@MyKelvin01
@MyKelvin01 2 года назад
There's an easier & simpler ways to have a centered logo. You just have to create 2 menus; one for left and one for right. Less headache. I mean, It works just perfectly. Amazing technique still.
@Gearyco
@Gearyco 2 года назад
Hard to maintain (moving a menu item from left to right). Hard to degrade to mobile (you need a third menu?). It’s definitely an option but has many downsides. These types of menus are a pain in the ass in general.
@MyKelvin01
@MyKelvin01 2 года назад
@@Gearyco yes, you need a third menu for mobile. Set the desktop Manu to hidden and BAM! I mean, it's not as dynamic as using the scss. It's just a cheap trick that works for "designers". however, a developer might lean more to the scss approach.
@anthonyramos5338
@anthonyramos5338 2 года назад
i self taught myself photoshop cs6... i wish i knew about tNice tutorials when i was in the self teacNice tutorialng mood
@nikitapatil7997
@nikitapatil7997 2 года назад
dude just look it up, there are free providers out there, it s goddaym expensive to buy, especially when you re a pro soft maker.
@Gearyco
@Gearyco 2 года назад
??
@DimitryChamy
@DimitryChamy 2 года назад
Cunning, conniving, and sly, as usual.
Далее
ИСТОРИЯ ПРО ШТАНЫ #shorts
00:32
Просмотров 279 тыс.
Только ЕМУ это удалось
01:00
Просмотров 1,8 млн
Думайте сами блин
18:15
Просмотров 602 тыс.
How is this Website so fast!?
13:39
Просмотров 621 тыс.
Stop Making This COMMON MISTAKE With Your Header Menus
35:13
My top 5 most popular front-end tips
22:07
Просмотров 36 тыс.
Data Analysis with Python for Excel Users - Full Course
3:57:46
ИСТОРИЯ ПРО ШТАНЫ #shorts
00:32
Просмотров 279 тыс.