{"id":24987,"date":"2016-09-06T22:28:31","date_gmt":"2016-09-06T21:28:31","guid":{"rendered":"https:\/\/www.megamenu.com\/documentation\/how-to-equally-distribute-menu-items-in-the-menu-bar-copy\/"},"modified":"2020-11-25T09:47:48","modified_gmt":"2020-11-25T09:47:48","slug":"highlight-active-menu-items","status":"publish","type":"ht_kb","link":"https:\/\/www.megamenu.com\/documentation\/highlight-active-menu-items\/","title":{"rendered":"How to highlight active menu items"},"content":{"rendered":"<p>Demo: see the top menu on this site. You will notice the &#8216;Documentation&#8217; item is (subtly) highlighted.<\/p>\n<h3>Applying the hover styling to active top level menu items<\/h3>\n<p>To apply the hover style to active \/ current <strong>top level<\/strong> menu items, go to <em>Mega Menu &gt; Menu Themes &gt; Menu Bar<\/em>\u00a0and enable the &#8216;Highlight Current Item&#8217; option.<\/p>\n<p><a href=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2018\/02\/highlight-current-item.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-142775 size-full\" style=\"max-width: 500px;\" src=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2018\/02\/highlight-current-item.png\" alt=\"\" width=\"984\" height=\"120\" srcset=\"https:\/\/www.megamenu.com\/wp-content\/uploads\/2018\/02\/highlight-current-item.png 984w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2018\/02\/highlight-current-item-300x37.png 300w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2018\/02\/highlight-current-item-768x94.png 768w, https:\/\/www.megamenu.com\/wp-content\/uploads\/2018\/02\/highlight-current-item-50x6.png 50w\" sizes=\"auto, (max-width: 984px) 100vw, 984px\" \/><\/a><\/p>\n<p>Highlighting sub menu items can be unreliable, so this option will only apply to the top level menu items. However, there is custom CSS below if you would like to try highlighting sub menu menu items.<\/p>\n<h3>Applying the hover styling to active sub menu items<\/h3>\n<p>There is no built in option to highlight active sub menu items as it can be unreliable. If you have 2 menu items pointing to the same page, each in different sub menus, both menu items will become highlighted.<\/p>\n<p>To apply the hover styling to active <strong>sub menu<\/strong> items, go to <em>Mega Menu &gt; Menu Themes<\/em> and insert the following into the Custom Styling area:<\/p>\n<pre class=\"lang:default decode:true \">\/* Apply Hover Styling to active Mega Menu - Second Level Links *\/\r\n#{$wrap} #{$menu} &gt; li.mega-menu-megamenu &gt; ul.mega-sub-menu &gt; li.mega-menu-item.mega-current-menu-item &gt; a.mega-menu-link,\r\n#{$wrap} #{$menu} &gt; li.mega-menu-megamenu &gt; ul.mega-sub-menu li.mega-menu-column &gt; ul.mega-sub-menu &gt; li.mega-menu-item.mega-current-menu-item &gt; a.mega-menu-link {\r\n    color: $panel_second_level_font_color_hover;\r\n    font-weight: $panel_second_level_font_weight_hover;\r\n    text-decoration: $panel_second_level_text_decoration_hover;\r\n    @include background($panel_second_level_background_hover_from, $panel_second_level_background_hover_to);\r\n}\r\n\r\n\/* Apply Hover Styling to active Mega Menu - Third Level Links *\/\r\n#{$wrap} #{$menu} &gt; li.mega-menu-megamenu &gt; ul.mega-sub-menu &gt; li.mega-menu-item li.mega-menu-item.mega-current-menu-item &gt; a.mega-menu-link,\r\n#{$wrap} #{$menu} &gt; li.mega-menu-megamenu &gt; ul.mega-sub-menu li.mega-menu-column &gt; ul.mega-sub-menu &gt; li.mega-menu-item li.mega-menu-item.mega-current-menu-item &gt; a.mega-menu-link {\r\n    color: $panel_third_level_font_color_hover;\r\n    font-weight: $panel_third_level_font_weight_hover;\r\n    text-decoration: $panel_third_level_text_decoration_hover;\r\n    @include background($panel_third_level_background_hover_from, $panel_third_level_background_hover_to);\r\n}\r\n\r\n\/* Apply Hover Styling to active Flyout Links and ancestors *\/\r\n#{$wrap} #{$menu} li.mega-menu-flyout ul.mega-sub-menu li.mega-menu-item.mega-current-menu-item &gt; a.mega-menu-link,\r\n#{$wrap} #{$menu} li.mega-menu-flyout ul.mega-sub-menu li.mega-menu-item.mega-current-menu-ancestor &gt; a.mega-menu-link,\r\n#{$wrap} #{$menu} li.mega-menu-flyout ul.mega-sub-menu li.mega-menu-item.mega-current-page-ancestor &gt; a.mega-menu-link {\r\n    @include background($flyout_background_hover_from, $flyout_background_hover_to);\r\n    font-weight: $flyout_link_weight_hover;\r\n    text-decoration: $flyout_link_text_decoration_hover;\r\n    color: $flyout_link_color_hover;\r\n}<\/pre>\n<h3>Applying Custom Styling to\u00a0active top level menu items<\/h3>\n<p>If you want to apply &#8220;active&#8221; styling which is different to the &#8220;hover&#8221; styling, go to <em>Mega Menu &gt; Menu Themes. <\/em>Set the &#8220;Hover&#8221; settings to how you&#8217;d like the menu items to appear on hover, then\u00a0insert the following into the Custom Styling area to set a different &#8220;Active&#8221; color.<\/p>\n<pre class=\"lang:default decode:true \">#{$wrap} #{$menu} &gt; li.mega-menu-item {\r\n    &amp;.mega-current-menu-item,\r\n    &amp;.mega-current-menu-ancestor,\r\n    &amp;.mega-current-page-ancestor {\r\n         &gt; a.mega-menu-link {\r\n              background: red;\r\n              color: white;\r\n              font-weight: bold;\r\n              text-decoration: underline;\r\n        }\r\n    }\r\n}<\/pre>\n<h3>Removing the highlight from an active menu item<\/h3>\n<p>To prevent a menu item from <em>ever<\/em> being highlighted, give the menu item a <a href=\"https:\/\/www.megamenu.com\/documentation\/how-to-add-custom-css-classes-to-wordpress-menu-items\/\">custom class<\/a> of &#8216;never-highlight&#8217;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Demo: see the top menu on this site. You will notice the &#8216;Documentation&#8217; item is (subtly) highlighted. Applying the hover styling to active top level menu items To apply the hover style to active \/ current top level menu items, go to Mega Menu &gt; Menu Themes &gt; Menu Bar\u00a0and&#8230;<\/p>\n","protected":false},"author":1,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"ht-kb-category":[14],"ht-kb-tag":[],"class_list":["post-24987","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-faqs"],"uagb_featured_image_src":[],"uagb_author_info":{"display_name":"Tom Hemsley","author_link":"https:\/\/www.megamenu.com\/author\/megamenu\/"},"uagb_comment_info":0,"uagb_excerpt":"Demo: see the top menu on this site. You will notice the &#8216;Documentation&#8217; item is (subtly) highlighted. Applying the hover styling to active top level menu items To apply the hover style to active \/ current top level menu items, go to Mega Menu &gt; Menu Themes &gt; Menu Bar\u00a0and...","_links":{"self":[{"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb\/24987","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/comments?post=24987"}],"version-history":[{"count":21,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb\/24987\/revisions"}],"predecessor-version":[{"id":271597,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb\/24987\/revisions\/271597"}],"wp:attachment":[{"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/media?parent=24987"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb-category?post=24987"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.megamenu.com\/wp-json\/wp\/v2\/ht-kb-tag?post=24987"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}