• manav kalra

    (@manavkalra15)


    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 ?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Pioneer Web Design

    (@swansonphotos)

    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.

    Krupal Panchal

    (@krupalpanchal)

    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.

    Pioneer Web Design

    (@swansonphotos)

    To be clear, one can add custom CSS based on the unique menu class to override what is provided in your theme.

    Thread Starter manav kalra

    (@manavkalra15)

    @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"

    Krupal Panchal

    (@krupalpanchal)

    @manavkalra15

    It can be possible if you are using a third-party theme. They may have added for particular design aspects.

    Thread Starter manav kalra

    (@manavkalra15)

    @krupalpanchal No I am using wordpress twentyfifteen theme.

    Krupal Panchal

    (@krupalpanchal)

    @manavkalra15

    Did you find any particular CSS in the theme like #menu-item-16601 {…}?

    Thread Starter manav kalra

    (@manavkalra15)

    No, even I don’t find “menu-item-type-post_type” & “menu-item-object-post” also

    Krupal Panchal

    (@krupalpanchal)

    @manavkalra15

    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.

    Thread Starter manav kalra

    (@manavkalra15)

    @krupalpanchal , So it means wordpress gives new css class for each new menu item.

    Krupal Panchal

    (@krupalpanchal)

    Yes

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Each menu item has new css’ is closed to new replies.