這是我的代碼,正如你所看到的機體有一些背景圖像,並且#cont應該是白色的。但我希望我的div元素透明,可以看到身體背景圖像。任何可以做到這一點的CSS技巧?CSS背景切割
body {
margin: 0;
border: 0;
padding: 0;
height: 100%;
width: 100%;
background-image: url(image.png);
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
#cont {
margin: 0;
border: 0;
padding: 0;
background-color: white;
}
#cont div {
margin: 20px;
border: 1px solid gray;
padding: 0;
width: 50px;
height: 50px;
float: left;
}
<div id="cont">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
你撥弄不顯示問題。 –
將image.png添加爲鏈接,以便我們可以看到它。 –
我知道,但我不希望我的div元素像#cont背景那樣變白。我希望他們能夠「剪切」白色背景並顯示身體背景圖像 –