我有以下问题
如果我在页眉中放置了可点击的图片,您将无法点击它。 (或公共(public)链接,两者都不起作用)
当我尝试在 header
之外重新定位图像时 - 它起作用了。
但是,当它仍在 header
中时,您无法点击它。
header {
position: relative;
width: 100%;
height: 80px;
background-color: #454d58;
margin: 0 auto 0 auto;
z-index: -10;
min-width: 100%;
}
li {
position: absolute;
top: 25px;
}
<body>
<header>
<ul>
<li>
<a href="#">
LINK
</a>
</li>
</ul>
</header>
</body>
最佳答案
您的 header
上有一个负的 z-index
,将其更改为正的或将其删除。
负 z-index
在堆叠上下文顺序中变得更低,因此您将无法点击它
header {
position: relative;
width: 100%;
height: 80px;
background-color: #454d58;
margin: 0 auto;
z-index: 1; /*whatever you need - want here - or just remove it */
min-width: 100%;
}
li {
position: absolute;
top: 25px;
}
<body>
<header>
<ul>
<li>
<a href="#">
LINK
</a>
</li>
</ul>
</header>
</body>
关于html - <header> 中的链接不可点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41572865/