hover doesn't change link color on most menu i

2019-08-26 01:33发布

问题:

div:hover changes link color only on a few wordpress menu items. Can't really figure out a reason for that. Why specifically these items? How do i make all of the work?

<div class="row">
             <div class="col-lg-12" id="mn">
              <?php wp_nav_menu( array( 'theme_location' => 'main-menu'  ) ); ?>
             </div> 
</div>

css

#mn ul {
list-style-type: none;
margin: 0;
    padding: 0;
}
#mn ul li {
display: inline;
text-align: center;
padding-right: 15px;
font-size: 12px;
}
#mn a:link {
color: #632121;
}
#mn a:hover {
color: #9F9F9F;
text-decoration:none;
}
#mn a:visited {color: #632121;}

回答1:

You have specified a:visited after a:hover, so your link will be the default color once you've clicked it, even on hover ...

#mn a:link, #mn a:visited {
  color: #632121;
}
#mn a:hover {
  color: #9F9F9F;
  text-decoration:none;
}

... should fix it.



回答2:

When style links you should follow this order:

a:link {}
a:visited {}
a:hover {}
a:active {}

You put visited after hover.