Replies: 2 comments 4 replies
-
Why would you need JavaScript to change the list from horizontal (li set to display: inline) to vertical (li set to display: block)? That can live in your viewport-specific part of the CSS, along with the visible hamburger etc.
Walter
… On Apr 2, 2023, at 9:22 PM, bjazmoore ***@***.***> wrote:
I started playing around with making the NAV work responsively. I was able to hide the menu items and slap on a hamburger menu. Obviously I would need some Javascript to make the UL/LI menu items display as a stacked menu item. I thought about slapping an ASIDE tag into the NAV, but that does not seem to do what I want. My extra CSS and custom classes started getting really complex and I thought "this is not the Pico.css way".
Anyone have some examples? I can post my code if you want it.
Thanks
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
|
Beta Was this translation helpful? Give feedback.
-
@bjazmoore you need neither JS nor an nav, nav ul {
flex-direction: column;
}
@media (min-width: 576px) {
nav, nav ul {
flex-direction: row;
}
} Here's a sample of it in action. This will make both the Note that I used the latest version as of date (v2.0.6). It works for any version that sets As for the burger menu, you can create one with its toggling effect in plain CSS using a styled label + checkbox input + rules that depend on Here's another sample that contains the responsive nav, burger menu to toggle menu items on narrow viewports using the latter approach and some animations to make it smooth. P.S.: Sorry to necropost, I only started using pico.css a week ago and I ended up looking for a potential pre-built way to enable this, leading me to this question and solution. Cheers! |
Beta Was this translation helpful? Give feedback.
-
I started playing around with making the NAV work responsively. I was able to hide the menu items and slap on a hamburger menu. Obviously I would need some Javascript to make the UL/LI menu items display as a stacked menu item. I thought about slapping an ASIDE tag into the NAV, but that does not seem to do what I want. My extra CSS and custom classes started getting really complex and I thought "this is not the Pico.css way".
Anyone have some examples? I can post my code if you want it.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions