作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一小段代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Asia Maldivas</title>
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<a href="#">TEST OUTER RELATIVE</a>
<div class="bg">
<a href="#">TEST</a>
</div>
</body>
</html>
CSS:
.bg {
position: relative;
background: linear-gradient(to bottom, rgba(18,138,167,0.95) 30px,rgba(62,195,209,0.95) 7%,rgba(12,115,160,1) 100%);
z-index: -1;
}
a {
text-decoration: underline;
z-index: 99;
}
现在我有一个不可点击的链接,我不明白为什么。
最佳答案
这是由z-index: -1引起的;如果您删除它,它将是可点击的。
关于html - 标记 <a> 在相对定位的 block 上不可点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35921935/
我是一名优秀的程序员,十分优秀!