2 回答

TA貢獻1820條經驗 獲得超2個贊
例如,向圖像添加 z 索引
#productCard {
height: 400px;
width: 400px;
background-color: #FFF;
border-radius: 25px;
z-index: 1
}
會將卡片放置在具有較低 z-index 的任何物體之上(默認情況下,所有物體的 z-index 均為 0),
你也可以做 z-index: -1 等...

TA貢獻1864條經驗 獲得超6個贊
你就快到了:
#contentContainer {
margin-top: 60px;
position: relative;
}
#imageContainer {
position: absolute;
top: -50px;
}
body {
background-color: #f6b93b;
height: 100%;
overflow: hidden;
}
#contentContainer {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
margin-top: 60px;
position: relative;
}
#imageContainer {
position: absolute;
top: -50px;
}
#productCard {
height: 400px;
width: 400px;
background-color: #FFF;
border-radius: 25px;
}
<html>
<head>
<title>Snippet</title>
</head>
<body>
<div id="contentContainer">
<div id="imageContainer">
<img src="https://via.placeholder.com/100">
</div>
<div id="productCard">
</div>
</div>
</body>
</html>
- 2 回答
- 0 關注
- 134 瀏覽
添加回答
舉報