Viewing 5 replies - 1 through 5 (of 5 total)
  • add css class to each menu element and style each class in style.css file.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    You could do it with CSS nth-child

    .nav-menu li:nth-child(1) { background: brown; }
    .nav-menu li:nth-child(2) { background: blue; }
    .nav-menu li:nth-child(3) { background: green; }

    And so forth.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    add css class to each menu element

    Twenty Twelve uses the wp_nav_menu function that already generated classes in each menu item.

    style each class in style.css file

    Can cause scalability issues, but perfectly legitimate.

    Thread Starter abidine

    (@abidine)

    thank you its work

    Please note that :nth-child selector in Internet Explorer works since version 9. You’ll need to use JavaScript code such as http://selectivizr.com/ or IE9.js to make it work in IE8 and earlier.

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

The topic ‘different colors menu wordpress’ is closed to new replies.