html - 由于背景图片,链接不起作用

标签 html css

由于某种原因,我的链接无法点击。我猜这是因为背景的原因,因为当我把它取下来时,它们就会起作用。但我不确定这是为什么。背景在css中设置:

div::after {
    min-height: 100%;
    min-width: 1024px;
    width: 100%;
    height: auto;
    top: 0;
    left: 0;
    content: "";
    display: block;
    position: fixed;
    background: url(brain.jpg) no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    background-size: cover;
    opacity: 0.1;
}

nav.horizontal li {
    width: 10.66%;
    margin: 0;
    padding: 0;
    font-size: 12pt;
}


nav ul {
    list-style: none;
    margin: 0 5px;
    margin-right: 19px;
    padding-top: 10px;
    padding-bottom: 46px;
}

导航的 html:

<nav class="horizontal">
    <ul>
        <li><a href="sitemap.html">Sitemap</a></li>
        <li><a href="formpage1.html">Quiz page 1</a></li>
    </ul>
</nav>

最佳答案

::after 可能会阻止点击,请尝试在此处添加 pointer-events: none; div::after {...}

div::after {
  pointer-events: none;
  min-height: 100%;
  min-width: 1024px;

  width: 100%;
  height: auto;


  top: 0;
  left: 0;
  content: "";
  display: block;
  position: fixed;
  background: url(brain.jpg) no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  background-size: cover;
  opacity: 0.1;

}

关于html - 由于背景图片,链接不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53406217/

相关文章:

javascript - Watir-webdriver - 选择列表显示样式 : none

javascript - 转义用户生成的内容 - 这意味着什么?

HTML 图例元素未计算在表单中

html - Bootstrap 行全宽

javascript - 如何在 JavaScript 中使用日历

html - 伪元素的中心元素

css - AsciiDoc 到 html5 外部 css

html - 将 div 置于彼此的中心

css - 使用 Sticky Footer 使 2 列布局中的左列占据 100% 高度

html - IE分页问题