hover doesn't change link color on most menu i

2019-08-26 01:10发布

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;}

2条回答
爷的心禁止访问
2楼-- · 2019-08-26 01:48

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.

查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-08-26 02:02

When style links you should follow this order:

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

You put visited after hover.

查看更多
登录 后发表回答