Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.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
Css 更改背景图像时,悬停时的颜色更改不起作用_Css - Fatal编程技术网

Css 更改背景图像时,悬停时的颜色更改不起作用

Css 更改背景图像时,悬停时的颜色更改不起作用,css,Css,如果此处的菜单.gif被其他图像替换,则悬停选项不起作用。谁能帮我找出这个问题吗 #menus li { display:inline; list-style:none; } #menus li a { background:transparent url(img/**menu.gif**) no-repeat; display:block; color:#382E1F; height:31px; line-height:31px; padding:0 20px; margin-left:-10

如果此处的菜单.gif被其他图像替换,则悬停选项不起作用。谁能帮我找出这个问题吗

#menus li {
display:inline;
list-style:none;
}
#menus li a {
background:transparent url(img/**menu.gif**) no-repeat;
display:block;
color:#382E1F;
height:31px;
line-height:31px;
padding:0 20px;
margin-left:-10px;
text-decoration:none;
font-size:12px;
font-weight: bolder;
float:left;
z-index:1;
}

#menus li a:hover{
display:block;
color: #382E1F;
font-size:15px;
background-color: green;
font-weight: bold;
} 

#menus li a.current {
background-position:0 -31px;
}
#menus li.current_page_item a, 
#menus li.current-cat a {
background-position:0 -62px;
}
#menus li a.home {
background-position:0 -93px;
width:45px;
padding:0;
margin-left:0;
text-indent:-999em;
}
#menus li a.home:hover {
background-position:0 -124px;
}
#menus li.current_page_item a.home {
background-position:0 -155px;
}
#menus li a.lastmenu:hover {
background-position:0 0;
cursor:default;
}

当您更改背景图像时,是否可以显示CSS


或者,如果您使用的是此CSS,
background color
层位于
background image

因此,在悬停时,您需要指定no
背景图像

#menus li a:hover{
display:block;
color: #382E1F;
font-size:15px;
background-image:none;
background-color: green;
font-weight: bold;
} 

谢谢你的简短回复。我跟随了你的线索,但如果背景图像设置为无,则图像根本不会显示在悬停状态。对于你的第一个问题,我只是将menu.gif替换为menu1.gif。