Skip to content Skip to sidebar Skip to footer

Vertical Menu (+ Sub-Menu) Stacks Unnaturally

I'm making an responsive menu which should be horizontal on desktop and align vertically on mobile. While the Desktop-Version has no issues, the Mobile one behaves really strange.

Solution 1:

This may not be the answer you're looking for but I hope it helps anyway...

Personally, I would use the (now not so) new CSS Flexible Box Layout to achieve what you want much more easily, there's a great guide to it at https://css-tricks.com/snippets/css/a-guide-to-flexbox/.

Essentially, what you'll want to do (among other options obviously) is have flex-direction: column on the desktop site and switch that to row on the mobile view. This simply switches the orientation of the menu from horizontal to vertical.

In my opinion this is the best (and most modern) way of doing this. However, it is worth noting that some would argue that browser support isn't as good as more traditional methods. This is true, but if you look at http://caniuse.com/#feat=flexbox, you'll see that in modern browsers it works fine.

I hope this is useful even though it's not a direct solution to your problem!


Post a Comment for "Vertical Menu (+ Sub-Menu) Stacks Unnaturally"