我想堆疊這些元素,使它們躺在另一個之上,但它們最終會水平地壓扁。我究竟做錯了什麼?相對定位的內容不是垂直堆疊?
HTML:
.content-wrapper {
position: absolute;
top: 0;
left: 0;
height:100%;
width:100%;
display: flex;
align-items: center;
justify-content: center;
}
.content-box {
background-color: #f2f2f2;
padding: 5vh 5vw;
font-family: "Roboto";
color: #676767;
text-align: center;
max-width: 60vw;
position: relative;
z-index:10;
margin: 1vh
}
<div class="content-wrapper">
<div class="content-box">
<span class="title"> Stats </span>
<br>
<div class="sep"></div>
<p> Lorem ipsum 1 </p>
</div>
<div class="content-box">
<span class="title"> Stats </span>
<br>
<div class="sep"></div>
<p> Lorem ipsum 2 </p>
</div>
</div>
「我試圖讓他們趴在彼此頂部堆疊這些元素, 「? Dint讓你... – Lal