【发布时间】:2020-06-18 18:22:06
【问题描述】:
我正在为此苦苦挣扎。我有一个带阴影的标题,下面有一个内容 div。除非内容 div 具有 z-index -1,否则阴影不会显示,但是我无法单击内容 div 中的任何元素。我错过了什么?
.container {
display: flex;
flex-direction: column;
}
.header {
background-color: green;
box-shadow: 5px 10px rgba(0, 0, 0, 0.5);
height: 60px;
width: 100%;
}
.body {
height: 300px;
width: 100%;
background-color: red;
z-index: -1;
position: relative;
}
<div class='container'>
<div class='header'>
</div>
<div class='body'>
<p onClick="(function() {
alert('Testing');})()">
TESTING
</p>
</div>
</div>
【问题讨论】: