html - 边框/框架覆盖 block 内容

标签 html css border z-index

我想要一个固定的框架和在它后面流动的内容。我用 border 属性做到了。但问题是无法访问带边框的图层下面的内容。它当然可见,但您不能选择文本(没问题)或单击链接(大问题)。

我的问题是如何使内容可访问,但仍使框架保持在顶部。

我不是专业人士,它用于个人投资组合页面,我希望仅使用 html5/css3 使其保持简单和干净。如果它不可能使用纯 css,我可能会容忍一些 javascrip。也许是带有“剪辑路径”、“蒙版”的东西,或者框架不是用“边框”制作的,而是用没有填充的 SVG 矩形制作的?希望它只是 html 和/或 z-indexes 的智能重新排列?我尝试了一个 hole day,但无法正常工作。

我做了一个图形表示来说明问题:

enter image description here

代码如下:

* { box-sizing: border-box; }
html, body { margin: 0; }

body{
  font-family: sans-serif;
  font-weight: bolder;
}

.max, .content{
  overflow: hidden;
}

.max{
  position: fixed;
  border: 1em solid black;
  top: 2em;
  right: 2em;
  bottom: 2em;
  left: 2em;
}

.one, .two{
  position: absolute;
  font-size: 2em;
  color: white;
  background-color: black;
  padding: 0.1em;
}

.one{
  top: -0.25em;
  left: 0;
}

.two{
  bottom: -0.25em;
  right: 0;
}

.content{
  display: flex;
  width: 100%;
  height: 100vh;
}

.link{
  margin: auto;
  color: white;
}

.content:nth-child(1){
  background-color: red;
}

.content:nth-child(2){
  background-color: green;
}

.content:nth-child(3){
  background-color: blue;
}
<div class="max">
  <span class="one">I AM A ...</span>
  <span class="two">FIXED FRAME</span>
</div>
<div id="wrapper">
  <div class="content">
    <a class="link" href="#">
      <h1>LINK</h1>
    </a>
  </div>
  <div class="content">
    <a class="link" href="#">
      <h1>LINK</h1>
    </a>
  </div>
  <div class="content">
    <a class="link" href="#">
      <h1>LINK</h1>
    </a>
  </div>
</div>

我真的希望有人能找到一个聪明的解决方案。

最佳答案

您可以使用 pointer-events: none; 但这对 IE 不是很友好。这将允许您“点击”框架。 http://caniuse.com/#feat=pointer-events

关于html - 边框/框架覆盖 block 内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31587156/

相关文章:

jquery - 更改滚动条的顶部边距

css - Font Awesome 5 在使用 JS+SVG 版本时显示空方 block

android - 如何同时为 ListView 添加边框和不同的行颜色

css - 子菜单顶部的顶部边框颜色

html - 让字幕文本换行在 IE 中工作

javascript - 如何使用zombie测试&lt;input type ="hidden">

css - div适配浏览器窗口的问题

javascript - 使用 JavaScript DOM 使用对象数组重写数据属性数组

jquery - 无法获取下拉选择的值

html - 为什么这个边界不可见?