Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何在鼠标悬停在li上时更改所有字体颜色_Html_Css_Background_Hover_Html Lists - Fatal编程技术网

Html 如何在鼠标悬停在li上时更改所有字体颜色

Html 如何在鼠标悬停在li上时更改所有字体颜色,html,css,background,hover,html-lists,Html,Css,Background,Hover,Html Lists,当我将鼠标悬停在一个列表元素(一个矩形)上时,里面的所有文本都变成白色,背景变成橙色 我的问题是,当您将鼠标悬停在li元素上时,“discProd”类中的文本不会变为白色。只有第一个文本变为白色 HTML <ol id="selectable"> <li class="ui-state-list"> <b>TD101</b> SmarTach + D: Tachometer</br> <h5

当我将鼠标悬停在一个列表元素(一个矩形)上时,里面的所有文本都变成白色,背景变成橙色

我的问题是,当您将鼠标悬停在li元素上时,“discProd”类中的文本不会变为白色。只有第一个文本变为白色

HTML

<ol id="selectable">
    <li class="ui-state-list">
        <b>TD101</b> SmarTach + D: Tachometer</br>
        <h5 class="discProd">Discontinued - See TA300 for replacement model</h5>
    </li>
</ol>

您需要将悬停效果分别应用于
discProd
类,如下所示:

#selectable li:hover {background: orange; color: white; }
#selectable li:hover .discProd {background: orange; color: white; }

您需要将悬停效果分别应用于
discProd
类,如下所示:

#selectable li:hover {background: orange; color: white; }
#selectable li:hover .discProd {background: orange; color: white; }

您需要将悬停效果分别应用于
discProd
类,如下所示:

#selectable li:hover {background: orange; color: white; }
#selectable li:hover .discProd {background: orange; color: white; }

您需要将悬停效果分别应用于
discProd
类,如下所示:

#selectable li:hover {background: orange; color: white; }
#selectable li:hover .discProd {background: orange; color: white; }
将此选项用于悬停:

#selectable li:hover, #selectable li:hover > .discProd {
    background: orange; 
    color: white;
}
无需重新定义类,只需将其应用于
.discProd

演示:

将此用于悬停:

#selectable li:hover, #selectable li:hover > .discProd {
    background: orange; 
    color: white;
}
无需重新定义类,只需将其应用于
.discProd

演示:

将此用于悬停:

#selectable li:hover, #selectable li:hover > .discProd {
    background: orange; 
    color: white;
}
无需重新定义类,只需将其应用于
.discProd

演示:

将此用于悬停:

#selectable li:hover, #selectable li:hover > .discProd {
    background: orange; 
    color: white;
}
无需重新定义类,只需将其应用于
.discProd

演示: