所以我希望“內容”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;}
設置最大高度會影響 z-index
寶慕林4294392
2024-01-22 20:58:32