2 回答

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

TA貢獻(xiàn)1864條經(jīng)驗(yàn) 獲得超6個(gè)贊
你就快到了:
#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 關(guān)注
- 149 瀏覽
添加回答
舉報(bào)