Css Color menu Wordpress -


i have issue background on menu each category through css example in picture below. wordpress.

background 1 category:

enter image description here

background 2 category:

enter image description here

if have name on menu sport make sport background colors love through css in wordpress.

you can use javascript code in case insert header.php or similar

<script type="text/javascript">     $( document ).ready(function() {         var test = document.getelementbyid("menu-item-26");         var check_exist = test.classlist.contains("current-menu-item");         if(check_exist){                 var x = document.getelementsbyclassname("header");                 x[0].style.backgroundcolor="#333";         }     }); </script> 
  1. change menu-item-26 id_of_your_menu

  2. keep current-menu-item because when menu selected class added in menu

  3. change header class class want change background.

  4. set color.

that's all.

my result

enter image description here


original

enter image description here


Comments

Post a Comment

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -