Home › Forums › Support › CSS to set the width of dropdown menus to fit the widest menu item not working This topic has 5 replies, 2 voices, and was last updated 2 years, 1 month ago by David. Viewing 6 posts - 1 through 6 (of 6 total) Author Posts March 5, 2022 at 7:58 am #2143498 Andrew Hello, I’m trying to set the width of dropdown menus to fit the widest menu item (desktop only). I tried using this CSS but it’s not working. I’m not sure if I have other CSS that might be conflicting with it. } .main-navigation ul ul { width: auto; white-space: nowrap; } March 5, 2022 at 9:09 am #2143561 DavidStaff Customer Support Hi there, try giving it some importance: @media(min-width: 1025px) { .main-navigation ul ul { width: auto !important; white-space: nowrap; } } And the media query is to stop it. messing up on mobile March 5, 2022 at 9:28 am #2143572 Andrew Hi David – Thank you. That worked but I noticed on tablet the drop-down menu is now shifted to the left when I click on the menu items. March 5, 2022 at 9:30 am #2143573 DavidStaff Customer Support Aah ok – I updated my CSS above https://generatepress.com/forums/topic/css-to-set-the-width-of-dropdown-menus-to-fit-the-widest-menu-item-not-working/#post-2143561 March 5, 2022 at 9:58 am #2143593 Andrew Perfect, thank you!! March 5, 2022 at 10:06 am #2143609 DavidStaff Customer Support You’re welcome Author Posts Viewing 6 posts - 1 through 6 (of 6 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In