You could use jQuery, if you’re open to a jQuery solution?
<script type="text/javascript">
jQuery(document).ready( function($) {
$('#your_menu_id li').has('ul').addClass('has_children');
});
</script>
Slight modification of what i posted here basically.
Any menu item with a submenu will then have a has_children
class you can target in the stylesheet..
#your_menu_id li.has_children { /* your styling */ }
#your_menu_id li.has_children ul { /* your styling */ }
#your_menu_id li.has_children ul li { /* your styling */ }
Hope that helps..
Related Posts:
- Assign a Class to the Current “Tag” for Formatting
- Dynamic sidebar nav with current page highlighting
- how to hide submenus for the not active pages
- Creating a second menu on Twenty Eleven aligned right from the first
- Superfish and WordPress: Active Color Problem
- Horizontal drop down category with hover effect working
- WordPress Custom Superfish CSS Problem [closed]
- Add “sub-nav” class to a sub menu parent item
- CSS to make HTML page footer stay at bottom of the page with a minimum height, but not overlap the page
- How to get these two divs side-by-side?
- What is the difference between the selectors “.class.class” and “.class .class”?
- Is background-color:none valid CSS?
- Float a div above page content
- What does an asterisk (*) do in a CSS selector?
- How can I horizontally align my divs?
- background-size: cover not working?
- combined multiple classes into one css rule
- Pure CSS to make font-size responsive based on dynamic amount of characters
- CSS – display: none; not working
- Is there an opposite to display:none?
- Rainbow gradient on text in CSS
- font-weight is not working properly?
- What would be the best method to code heading/title for ul or ol, Like we have caption in table?
- How can I make my header image properly responsive?
- wp_enqueue_scripts, wp_register_scripts, wp_print_scripts: i’m confused
- What is the correct way to enqueue multiple CSS files?
- Remove wp_add_inline_style
- Which Details Are Required For Style.css File Header?
- How to implement different color schemes in your themes
- @font-face doesn’t work
- How to target first img in every wordpress post with CSS [closed]
- How to change Parent Themes in Child Theme CSS
- hSite has no css on mobile [closed]
- Set Image width=’x%’ (percentage width not pixel width) when inserted via the media manager?
- Where is definied the theme location for the main menu in a WordPress template?
- Relative path in wp_register_style not working
- Enable specific CSS Code for Visitors and specific Roles
- Hide Hamburger Menu On Specific Page (Front Page/Home Page)
- Different ways to load child theme css
- Importing changes to Child Theme
- Style internal links based on the tags of the linked post
- How to override Bootstrap css with my child theme css in wordpress?
- How to stop Gutenberg from outputting inline CSS for specific blocks?
- Move the position of menu item [closed]
- Redirect to another page using contact form 7? [closed]
- Title has word broken when viewed in mobile [closed]
- Change background color of subpages
- How to fix this error? [closed]
- How to make WordPress using local CSS/Fonts/Scripts only
- WordPress code editor messed up my code!
- How to know which order WordPress places CSS files?
- Placing background image over section divider
- WordPress CSS problems with controls
- Remove CSS & JS from
- enqueing Javascript and CSS
- Aligning line made with CSS [closed]
- Earlier stylesheet not overriding later one
- Overwriting forced wordpress CSS styles [closed]
- Drop Down menu expanded by default (on front page) [closed]
- wp nav menu: show submenu below li item
- Styling an “active” link outside of WordPress default menu
- Fixed height of the_content()
- W3TotalCache and Javascript — what should go where, when?
- CSS not being applied
- Help with a little CSS logo/header modification?
- WordPress menu: How to make www.link.com/#name never contain current_page_item class?
- WordPress sidebar content moving to bottom of page
- custom template display 3 columns
- Making the menu toggled open on mobile devices Illustratr theme
- underscores theme – sass folder structure vs smacss
- Inclution place of CSS file
- Img load while refreshing
- How to Compress Css/js code in wordpress and increase loading speed?
- Twenty Fourteen: Unsticky header after making header bigger
- Loading css files conditionally useful?
- WordPress site using unknown overriding css
- Is there any way to turn off a particular scrolling behaviour?
- Sidebar at bottom however I have completely replaced theme folder back to original code
- Site not 100% responsive
- Dropdown menu’s fighting with each other [closed]
- Header formatting works for safari but not chrome @media screen size technique on iphone
- Scale An Image Thumbnail
- Active menu item / category
- Adding a css style to the main nav menu in child pages
- Adding custom css to a theme depending on whether the admin user is logged in or not
- Help with changing style of the extended menu drop down [closed]
- Adjusting post width according to the image size
- single.php doesn’t getting style
- How do i keep my current page menu highlighted on pagination?
- Converting Static HTML pages to WordPress
- Background tiles not working in iPad2 but ok everywhere else
- How to make widgetized footer styles be inherited from body?
- To override CSS of parent theme
- How to customize a theme’s navigation menu with css
- [class*=”content”]:before css styles in TwentyThirteen [closed]
- How to change the CSS in one file?
- Enqueue MCE Editor CSS in admin page
- WordPress site suddenly not showing some DOM elements but mobile is fine
- Editing size of h3 tag in wordpress on a one-off basis
- Content doesn’t fit on large size desktops like 2560×1440