我想在CSS中调用div id函数,以便当鼠标悬停在文本上方时将其突出显示
<ul class="sub-menu">
<li id="menu-item-1721" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1721"><a href="http://18.205.33.160/index.php/services/strategic-it-consulting/?customize_changeset_uuid=924e99ff-4237-48e6-8ab2-5902b4e0b6c1&customize_messenger_channel=preview-0" target="_self">Strategic IT Consulting</a></li>
是否可以使用CSS为ul类中的所有子菜单调用此方法?
.sub-menu:hover {
color:green
}
答案 0 :(得分:1)
.sub-menu li a:hover {
color:green
}
答案 1 :(得分:0)
您可以在文本周围使用标记标签
mark:hover {
background-color:green
}
mark
{
background-color:white
}
<ul class="sub-menu">
<li id="menu-item-1721" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1721"><a href="http://18.205.33.160/index.php/services/strategic-it-consulting/?customize_changeset_uuid=924e99ff-4237-48e6-8ab2-5902b4e0b6c1&customize_messenger_channel=preview-0" target="_self"><mark>Strategic IT Consulting</mark></a></li>