1个回答
展开全部
如下:
#div1 a:hover {
background:red;
}
#div2 a:hover {
color:yellowgreen;
}
#div3 a:hover {
background:red;
color:white;
}
#div4 a:hover {
font-weight:bold;
}
具体一点的例子:
<!DOCTYPE html>
<html>
<head>
</head>
<style type="text/css">
#div1 {
width:200px;
height:100px;
border:1px solid pink;
margin-bottom:10px;
}
#div2 {
width:200px;
height:100px;
border:1px solid red;
margin-bottom:10px;
}
#div3 {
width:200px;
height:100px;
border:1px solid green;
margin-bottom:10px;
}
#div4 {
width:200px;
height:100px;
border:1px solid blue;
margin-bottom:10px;
}
#div1 a:hover {
background:red;
}
#div2 a:hover {
color:yellowgreen;
}
#div3 a:hover {
background:red;
color:white;
}
#div4 a:hover {
font-weight:bold;
}
</style>
<body>
<div id="div1">
<a href="">我在div1中,改变背景色</a>
</div>
<div id="div2">
<a href="">我在div2中,改变字体颜色</a>
</div>
<div id="div3">
<a href="">我在div2中,改变背景色和字体颜色</a>
</div>
<div id="div4">
<a href="">我在div3中,加粗字体</a>
</div>
</body>
</html>
效果图:
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询