我在我的網頁上有一個傳送帶,我試圖讓它在所有設備中都能夠響應。使圖像對所有設備都有響應
我這麼規定的高度上3個不同的設備CSS聲明相應爲350像素,255px,125px
.banner{
max-width:100% !important;
background:url(http://xxx/images/slide4.jpg) no-repeat;
min-height:350px;
background-size:cover;
-webkit-background-size:cover;
-moz-background-size:cover;
-o-background-size:cover;
-ms-background-size:cover;
}
.banner{
min-height:255px;
max-width:100% !important;
background:url(http://xxx/images/slide4.jpg) no-repeat;
}
.banner{
min-height:125px;
max-width:100% !important;
background:url(http://xxx/images/slide4.jpg) no-repeat;
}
我的HTML代碼:
<div class="banner"> </div>
請告知我怎樣才能讓我的形象,以適應跨越所有的設備。提前致謝。
可能的複製[使圖像響應 - 最簡單的方法(HTTP://計算器。 com/questions/15458650/make-an-image-responsive-simplest-way) – lyndact
您沒有使用@media查詢的具體原因是什麼? – Airwind711
我會爲每種媒體類型使用不同的圖像,因此您的瀏覽器無需使用矢量縮放。這和[@media](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries)規則。 – PHPglue