[英]DIV on top of background
I found a very interesting image grid background on Codepen, that I'd like to use. 我想在Codepen上找到一个非常有趣的图像网格背景。 Only thing is i'm experiencing issues with getting a DIV on top of it.
唯一的问题是我在使用DIV时遇到了问题。
https://codepen.io/pirolab/pen/qmeNqY https://codepen.io/pirolab/pen/qmeNqY
I've tried things such as top, z-index, but for some reason I'm struggling to get anything to be on top of the images. 我已经尝试过诸如top,z-index之类的事情,但是由于某些原因,我一直在努力使任何东西都位于图像之上。
Example of something I've tried 我尝试过的例子
<section class="o-hero">
<div class="o-cards__main">
<div style="z-index:999;top:5;background:blue">Hello<div>
<div class="o-cards__container" id="container">
</div>
</div>
</section>
I'd really appreciate it if someone could help. 如果有人可以提供帮助,我将非常感激。
https://codepen.io/andrasadam93/pen/KyNvoe forked from yours if I understood your query correctly. 如果我正确理解了您的查询,则从您的https://codepen.io/andrasadam93/pen/KyNvoe分叉。 The key parts are these (although I added some extra for visibility):
关键部分是这些(尽管我添加了一些额外的可见性):
<section class="o-hero">
<div class="overlay">
<p>This is overlay</p>
</div>
<div class="o-cards__main">
<div class="o-cards__container" id="container"></div>
</div>
</section>
.overlay{
position:absolute;
z-index:999;
width: 100%;
height: 100%;
font-size: 24px;
font-weight:700;
color:#ff0000;
display:flex;
align-items:center;
justify-content:center;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.