Welcome to the Treehouse Community
Looking to learn something new?
Margaret Godowns6,268 Points
Where does sub-menu styling come from?
I think I'm missing a step here. How does Wordpress know how to style the sub-menu elements? I know we pass the 'no-bullet' class to the ul in the $defaults array, but we don't ever assign a 'sub-menu' class to the sub-menu ul. However, I see that a 'sub-menu' class is present in the markup when I inspect element. Is this something that Wordpess does automatically? Do we just need to include styling for the 'sub-menu' class in our stylesheets?
You are correct, the
.sub-menu class comes automatically from WordPress and you'll just need to include styling for it in your stylesheet. Keep in mind that if you have a third-level of menu items, the
.sub-menu class will appear again, as it naturally appears for all sub menus of navigation items built with the
wp_nav_menu() function. Hope this helps!