Each menu item has new css
-
Hello,
I want to know each menu item has its own new css or not ? I was looking in source code of my website and found div class for menu item
menu-item menu-item-type-post_type menu-item-object-post menu-item-16601, these numbers “16601” are different for each menu item so does this means each menu item has its own new css different from other menu items ?-
This topic was modified 4 years ago by
manav kalra.
-
This topic was modified 4 years ago by
-
Simply, yes. That said you want to be careful to look at the menu(s) CSS across devices – desktop, tablet, mobile. Most themes provide different classes for them and/or responsive @media widths.
So the answer to your question is No.
Because WordPress gives this uniqueness to every aspect. Like if you see, It adds a unique post id to body class, same as in menu items, in article tag for default post loop. So it doesn’t mean that it adds CSS for every item.
It is for our reference if you want to give particular CSS to any element/page, you can give it.
To be clear, one can add custom CSS based on the unique menu class to override what is provided in your theme.
@krupalpanchal “It adds a unique post id to body class, same as in menu items” , Yes I agree to this but each menu item has different unique li id but has unique id in css also thats why I am asking.
li id="menu-item-16601" class="menu-item menu-item-type-post_type menu-item-object-post menu-item-16601"-
This reply was modified 4 years ago by
manav kalra.
It can be possible if you are using a third-party theme. They may have added for particular design aspects.
@krupalpanchal No I am using wordpress twentyfifteen theme.
Did you find any particular CSS in the theme like #menu-item-16601 {…}?
No, even I don’t find “menu-item-type-post_type” & “menu-item-object-post” also
That is the thing I’m telling you!! WordPress adds it for our reference to give CSS for the particular item. As it generates dynamically every time and never changes.
@krupalpanchal , So it means wordpress gives new css class for each new menu item.
Yes
-
This reply was modified 4 years ago by
The topic ‘Each menu item has new css’ is closed to new replies.