html5 代码问题,如何设置hover,使整个背景图片变色.

2025-05-21 15:54:41
推荐回答(2个)
回答(1):

一:就是那一行,你没有想错。只不过是其它地方做错了。

二:

AAAAAAsdasd

a:这一行已经在style里面写死了,所以更改了.content:hover也不起作用,

b:background-color在有background-image的情况下,不起作用。

c:.content1 :hover这里面又多了一个空格。有的时候,也会导致失败。

三:正确的代码:









Document


.content1{
border-radius:50px;
height:400px;
width:300px;
float:left;
position:fixed;
bottom:50px;
left: 750px;
background-image:url(img/1.jpg);
}
.content1:hover{
background-color: white;
background-image:url(img/2.jpg);
}


 

AAAAAAsdasd

 


回答(2):



AAAAAAsdasd



你代码中格式错误如下:.content1 :hover 这个css中间是不能有空格的,正确的写法是.content1:hover

相关问答