P粉5233350262023-08-14 13:09:51
不完美,但這是如何在卡片上完成的,position: absolute
在蝴蝶結上允許您將蝴蝶結定位在所需位置的卡片上。
.card { display: flex; align-items: center; position: relative; width: 300px; height: 150px; border: 1px solid #ccc; border-radius: 8px; padding: 20px; background-color: #fff; } .ribbon { position: absolute; top: 10px; left: 0px; background-color: #e74c3c; color: #fff; padding: 5px 15px; }
<div class="card"> <div class="ribbon">Side Offer</div> <h3>Card Content</h3> <p>This is some content inside the card.</p> </div>