Jump to content

W3.css Navigation - Dropdown menu block not Scrollable


Recommended Posts

I am using "Navigation Bar with Dropdown" on https://www.w3schools.com/w3css/w3css_navigation.asp This works well. My only problem is that one of the menus is having 15 submenus (dropdown items). In this case case only 8 are shown till the bottom of the viewport and rest are not shown. (View Page Source has those items in the rendered HTML). Hence I would like to get help to add the vertical scrolling. I would like to know which class(es) should have Overflow attribute set to Auto. I am using Firefox browser V 72.x

Another solution could be to have multiple columns of submenus. Say 7 items per column.

Thanks.

 

Link to post
Share on other sites

You can add overflow to the w3-dropdown-content class and give it a max-height in order to cause the scrolling. On mobile devices, arranging the links into columns would likely get outside of the screen horizontally.

  • Thanks 1
Link to post
Share on other sites
On 2/12/2020 at 9:22 AM, Ingolme said:

You can add overflow to the w3-dropdown-content class and give it a max-height in order to cause the scrolling. On mobile devices, arranging the links into columns would likely get outside of the screen horizontally.

Perfect! On mobile, I am using "hamburger" menu so no worries but thanks for pointing out the pitfall of using multiple columns for submenus.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...