所以我希望“内容”div 出现在“封面”div 上,这通常工作正常,但是一旦我设置“内容”div 的最大高度,它就无法执行此操作。
此处可重现的最低限度。您可以看到,如果删除 CSS 的第 66 行,它会按预期运行,但会以某种方式与第 66 行一起运行。
帮助表示赞赏!谢谢。
如果有人想知道,请附上代码: HTML:
<div class = "wrapper">
<div class="card-container">
<div class="card">
<div class="cover"></div>
<div class="content">
<div class="text">
<p>this is a long-ass line that is supposed to cause overflow</p>
<p>this is a long-ass line that is supposed to cause overflow</p>
<p>this is a long-ass line that is supposed to cause overflow</p>
<p>this is a long-ass line that is supposed to cause overflow</p>
<p>this is a long-ass line that is supposed to cause overflow</p>
<p>this is a long-ass line that is supposed to cause overflow</p>
<p>this is a long-ass line that is supposed to cause overflow</p>
<p>this is a long-ass line that is supposed to cause overflow</p>
<p>this is a long-ass line that is supposed to cause overflow</p>
<p>this is a long-ass line that is supposed to cause overflow</p>
<p>this is a long-ass line that is supposed to cause overflow</p>
</div>
</div>
</div>
</div>
</div>
CSS:
.card-container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.card {
width: 300px;
height: 200px;
background-color: #d9b3ff;
position: relative;
transform-style: preserve-3d;
cursor: pointer;
}
慕桂英546537
ibeautiful
相关分类