我希望馬里奧影像在下面的螢屏截圖中位于該背景之上,如您所見,它正在作業,但是我無法將馬里奧影像置于背景之上。我還想洗掉背景影像上多余的不需要的重復圖案。代碼:
.marioHeader{
background-image: url("resources/marioBackground.jpg");
background-size: 600px;
height: 500px;
background-position: bottom;
margin: auto;
}
.headermario {
background-image: url("resources/banner.png");
background-size: 600px;
background-repeat: no-repeat;
background-position: bottom;
height: 200px;
display: block;
margin: auto;
}
<div class="marioHeader">
<div class="headermario">
</div>
</div>
它的外觀影像:
uj5u.com熱心網友回復:
對于居中,您可以使用 flexbox 輕松做到這一點:https ://jsfiddle.net/tdfu3em1/2/
只需給容器 div:
display: flex;
justify-content: center;
align-items: center;
現在子 div 將居中。
至于重復模式,沒有足夠的資訊知道。它在原始影像中重復嗎?我猜不是,你沒有重復。但是你想在它的地方發生什么?沒有什么?背景顏色?有點取決于。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/481628.html
