gpt4 book ai didi

html - <header> 中的链接不可点击

转载 作者:太空宇宙 更新时间:2023-11-04 09:19:33 24 4
gpt4 key购买 nike

我有以下问题

如果我在页眉中放置了可点击的图片,您将无法点击它。 (或公共(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 - &lt;header&gt; 中的链接不可点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41572865/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com