This question already has answers here:
CSS div height 100% not working
(3个答案)
Why doesn't height: 100% work to expand divs to the screen height?
(9个答案)
2年前关闭。
我正在尝试将鼠标悬停在链接上以使用“相邻的兄弟选择器”更改div中的图像,但是当我将鼠标悬停在链接上时,它不会显示任何内容。
CSS:
(3个答案)
Why doesn't height: 100% work to expand divs to the screen height?
(9个答案)
2年前关闭。
我正在尝试将鼠标悬停在链接上以使用“相邻的兄弟选择器”更改div中的图像,但是当我将鼠标悬停在链接上时,它不会显示任何内容。
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" href="styletest.css">
</head>
<body>
<div>
<a class="a" href="/template-1978944/editor"> ANATOMY NOW
</a>
<div class="bg"> </div>
</div>
</body>
</html>
CSS:
.bg{
height:100%;
}
.a:hover + .bg {
background-image: url('https://preview.ibb.co/gce5me/anatomy_Now.png');
}
最佳答案
如果需要填充视口的背景,也可以使用height:100vh;
关于html - 将鼠标悬停在链接更改背景图片上,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/52408525/
10-11 14:13