您的位置:首页 > Web前端 > JavaScript

a标签突出显示盒子非js效果

2017-07-29 17:34 141 查看
鼠标放在相应的标题上,显示对应的盒子

<!DOCTYPE html>

<html>
<head>

<meta charset="utf-8">
<title></title>
<style>
a{
text-decoration: none;
color: #000;
}
.box{
width: 300px;
height: 300px;
position: relative;
border: 1px solid #000;
}
ul li{
list-style: none;
float: left;
display: block;
}
.box1{
width: 200px;
height: 200px;
background-color: red;
position: absolute;
left: 40px;
top: 40px;
display: none;
}
.box2{
width: 200px;
height: 200px;
background-color: blue;
position: absolute;
left: 40px;
top: 40px;
display: none;
}
ul li:first-child:hover .box1{
display: block;
}
ul li:nth-child(2):hover .box2{
display: block;
}
</style>

</head>

<body>
<div class="box">
<ul>
<li>
点击显示1
<div class="box1"></div>
</li>
<li>
点击显示2
<div class="box2"></div>
</li>
</ul>
</div>

</body>

</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: