css鼠标悬停时为其他标签设置样式
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>鼠标悬停时为其他标签设置样式</title>
<style type="text/css">
.a{ width:80px;height:24px;text-align:center;line-height:24px;background:red;}
.a:hover a{color:#fff;text-decoration:none;}
</style>
</head>
<body>
<div class="a">
<a href="#">test</a>
</div>
</body>
</html>
注意:
需要改变样式的标签必须包含在当前鼠标悬停元素中;