<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>网页标题</title>
<style>
body{
width: 100%;
height: 100%;
}
.div1, div2{
position: fixed;
width: 100%;
height: 100%;
}
a{
color: #000000;
}
a:hover{
color: #808080;
}
</style>
</head>
<body>
<div class="div1">
<a href="about:blank">链接</a>
</div>
<div class="div2">
<p>----------------文字</p>
</div>
</body>
</html>
a:hover
不生效,删除div.div2
就生效了。
如何达到:不删除或隐藏div.div2
,也能让div.div1
中的a:hover
生效?
用z-index给层级关系
闲着就回答一下吧
你的代码,你这个是不是写错了
.div1, div2{
position: fixed;
width: 100%;
height: 100%;
}
应该是这样吧
.div1,.div2{
position: fixed;
width: 100%;
height: 100%;
}
废话了那么多,那么要使你的div1里的a标签不被覆盖,最简单的方案就是,设置div2的z-index为-1,你就可以点到那个a标签了,当然还有其他方案,不过对于这个就可以解决了