因此,我想疊加一些圖像,但僅限於在iPad/iPhone上查看網站時。CSS在特定屏幕大小上疊加圖像
我已經寫了下面的代碼,它本身就是應該的。但是,添加@media函數時,什麼都不會發生。
HTML:
<section class="logos">
<div class="container">
<div class="img1"><img src="./images/testing1.png" alt="">
</div>
<div class="img2"><img src="./images/testing2.png" alt="">
</div>
<div class="img3"><img src="./images/testing3.png" alt="">
</div>
<div class="img4"><img src="./images/testing4.png" alt="">
</div>
<div class="img5"><img src="./images/testing5.png" alt="">
</div>
</div>
</section>
CSS:
@media only screen and (min-width: 0px) and (max-width: 768px) {
.container{
position:relative;
left:0;
top:0; }
.img1{
position:absolute;
top:0;
left:0; }
.img2{
position:absolute;
top:0;
left:0; }
.img3{
position:absolute;
top:0;
left:0; }
.img4{
position:absolute;
top:0;
left:0; }
.img5{
position:absolute;
top:0;
left:0; }
}
這是按原樣工作:https://jsfiddle.net/ – mtaube