得到这个代码工作:
<style type="text/css">
body {
margin: 0px;
}
#hallo {
width: 960px;
height: 600px;
position: relative;
margin: auto;
border: solid 1px yellow;
}
#bg {
width: 960px;
height: 600px;
position: absolute;
background-image:url(torres.jpg);
background-size: 960px 600px;
}
#t1 {
width: 100px;
height: 100px;
position: absolute;
background-size: 100px 100px;
border: solid 1px white;
}
#t1 {
top: 100px;
left: 600px;
background-image:url(torres1.jpg);
}
#t1:hover ~ #bg {
position: absolute;
background-image:url(torres1.jpg);
background-size: 960px 600px;
}
</style>
<section id="hallo">
<div id="bg"></div>
<div id="t1"></div>
</section>
但我有一个问题。当我将鼠标悬停在 t1 div 上时,没有任何反应。背景图像不会更改为“torres1.jpg”。有什么解决办法吗?
我不能为此使用java。