Although this is not really a WordPress question, but the visibility
property does not actually HIDE any element. It only fades it so you can’t see it, but it still reserves space for it. You need to use the display
property:
.mobile-only {
display:hidden;
}
@media (min-width:992px) {
.desktop-only {
display:block !important;
}
}
@media (max-width: 991px) {
.mobile-only {
display:block!important;
}
.desktop-only {
display:hidden !important;
}
}
You might want to change the block
to inline-block
or inline
, depending on the original value of your menu’s item (which is usually inline-block
).
Related Posts:
- How to get a different mobile menu than desktop menu in the twentytwelve child theme
- Second nav is merged with the first in mobile
- How to add a submenu toggle button inside all “li” elements that have a submenu?
- Convert WP Menu to a Drop Down for Mobile browser
- Efficient wp mobile menu
- Mobile menu displays submenus on top of parent. Need it to display right below on an own line
- Add href to tag in nav menu for mobile
- Disable Top Nav Bar on Mobile
- menu mobile show up even i in desktop mode in Newspaper Theme
- Image menu on responsive WordPress
- How can I only show one responsive menu on mobile devices?
- Custom ID for certain menu item?
- Add data-icon input to WordPress custom menu links
- How to stop mobile theme inheriting desktop navigation menu?
- Show current navigation path from menu
- Add class to active top level (grandparent) menu item
- How to get Menu Navigation Labels to output HTML
- custom menu not found
- Number of items in a menu
- wp_nav_menu doesn’t generate parent/ancestor classes
- How to add text before WordPress menu item href
- Add an extra field to the navigation menu box?
- How do i style the current menu anchor link’s parent anchor link? [closed]
- Does the menu item ID ever change?
- Hide and show menu subpages
- Benefits of using Nav Walker?
- Mobile menu works on local XAMPP, but not on GoDaddy [closed]
- Use walker for specific menu, or avoid use of walker
- Change where navigation bar links?
- has_children in custom nav_walker
- How to have custom menu Item CSS Classes for wp_page_menu() or wp_list_pages()
- How to fix “Supplied nav_menu_item value missing property” after update to WordPress 5.0
- wp_nav_menu including Skype URL
- Change an li class name in a wordpress custom menu walker
- Separator for custom nav menu
- How do I add recent posts to the menu?
- Conditional secondary menus
- Determine the last child of the parent menu WP Nav Walker
- Nav and logo loading each time causing menu to move JointsWP – Foundation 6
- Navigation doesn’t render when wp is hosted
- Does is_child() exist in wp 3.5.1?
- Using _s theme, menu changes do not affect header menu
- Add span in top menu item with nested itens
- Show children (sub-navigation) of active menu item only
- Menu Arrow for Child Element
- Responsive dropdown menu with smaller screen sizes
- Adding an external link to wordpress menu
- Add a counter beside menu item label
- set certain item in nav walker to active when on archive pages or singles
- The cart, checkout, and shop links not getting removed
- Twenty Fifteen: Change navigation menu behavior
- Switch an entire nav menu if user is logged in
- WordPress functions.php does not affect the theme menus
- Display Menu Navigation Label
- Menu is not displaying on the site navigation [closed]
- Odd spacing in Navigation Bar [closed]
- wp_list_pages Hierarchical Help
- How to avoid the and which added when custon menu widget is used
- Add pages content to startpage through custom menu
- Updated WordPress, now Navigation is Messed Up
- My menu doesn’t fit in the default screen in the mobile version
- How to change how WordPress renders navigation menu on Block Themes
- Problem with links once in portfolio item
- Top bar menus not showing on mobile
- Possible to append class to nav menu added to widget area?
- url_to_postid method in walker_nav navigation menu causing exceptionally high TTFB
- Add Different Class on Different Ul in twenty-twentyone theme
- Get Each Menu Nav Label of Menus in HTML tag
- wp_nav_menu container style args
- How can I click the parent menu then redirect to a special URL?
- How do I display menu in header without loosing styles?
- Adding additional html to the end of the root level in a custom nav walker
- Navbar is hidden behind carousel when using wp-boostrap-navwalker
- Change menu for mobile
- Navigation bar is on live site but nothing under menu so can’t add in a page
- display cart information within li of cart menu item
- Show thumbnail to category items in wp_nav_menu(), how?
- Add data-track to links in menu
- Conditional Nav Menu Inside Nav Menu Across Multisite Sites
- Is it possible to seperate wordpress menu by different div?
- How to add odd and even classes to all nav links through walker?
- Output sort number in wp menu list item?
- Check in walker if current page is descendant
- Active page link not getting class assigned
- Mobile Menu Not Working
- Customize Walker_nav_menu to show posts if item is category
- Replace Menu Item with Logged in username
- Where these arguments are defined?
- Show All Children of WordPress Menu
- Navigation list not correctly styled on pages with custom template (missing .current-menu-item)
- How to make an anchored page in a navigation menu tab
- How was this menu system created?
- How can I structure my pseudo footer nav code with wordpress codex code?
- Two Homes In Navigation Menu
- How to set menu Display location
- What is the best way to incorporate responsive dropdown navigation menu into custom theme?
- How to add a class directly on a unordered list element that is a primary navigation
- How do I programatically remove Menus?
- Displaying a Custom Avatar in WP Bootstrap Navwalker Menus in WordPress
- Is there a way to make it so that I don’t get a hamburger menu, but rather a desktop style nav, when resizing to a mobile size