我不明白为什么我的 anchor 悬停不会导致下面的 div 框变成黄色。这是我的代码:
<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
a {background-color:Blue; width:400px; height:200px;}
#hide { width:500px; height:500px;background-color:black; }
a:hover #hide {background-color:yellow; }
</style>
</head>
<body>
<a>hover</a>
<div id="hide">turn yellow</div>
</body>
</html>
我现在很累,所以我一定是忽略了一些简单的事情
最佳答案
您正在关闭 <a>
介绍前hide
, 所以路径
a:hover #hide
永远不会应用。
关于css - 简单的 CSS 悬停问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3346549/