你好我试图在页面处于活动状态或选中时更改菜单项的背景颜色,我尝试使用css的正常方式,这是我试过的
#tve_editor .thrv_widget_menu.thrv_wrapper ul.tve_w_menu a:selected {
color: #373737;
text-decoration: none;
display: inline-block;
line-height: 1;
padding: 10px 0;
position: relative;
background-color: blue;
}
#tve_editor .thrv_widget_menu.thrv_wrapper ul.tve_w_menu a:active {
color: #373737;
text-decoration: none;
display: inline-block;
line-height: 1;
padding: 10px 0;
position: relative;
background-color: blue;
}
#tve_editor .thrv_widget_menu.thrv_wrapper ul.tve_w_menu a:current {
color: #373737;
text-decoration: none;
display: inline-block;
line-height: 1;
padding: 10px 0;
position: relative;
background-color: blue;
}
这就是我想要实现的目标
这是您可以看到菜单状态的当前页面: web link
有没有其他方法可以让这个菜单看起来那样?
答案 0 :(得分:1)
你需要使用悬停css选择器。看看这里! http://www.w3schools.com/cssref/tryit.asp?filename=trycss_sel_link_more1
类似的东西:
#tve_editor .thrv_widget_menu.thrv_wrapper ul.tve_w_menu a:hover {
color: #373737;
text-decoration: none;
display: inline-block;
line-height: 1;
padding: 10px 0;
position: relative;
background-color: yellow;
}
答案 1 :(得分:0)
#tve_editor .thrv_widget_menu.thrv_wrapper ul.tve_w_menu li.current-menu-item > a {
color: #373737;
text-decoration: none;
display: inline-block;
line-height: 1;
padding: 10px 0;
position: relative;
background-color: blue;
}