1
我的問題是關於背景圖像。我正在設計iPhone屏幕的主頁,我想爲移動版本使用稍微不同的圖像。我的媒體查詢不在一個單獨的css文件中,只是嵌入在index.html中。問題...主要的CSS圖像覆蓋了我的查詢圖像。我檢查了額外的括號等。我認爲媒體查詢優先於主要的CSS?如果我已將媒體查詢放入css鏈接文件中,我會得到我想要的結果嗎?哪個背景圖片優先.media查詢或css?
這是我主要的CSS代碼:
#container
{
background-image:url(images/1000_framec.jpg);
background-repeat:no-repeat;
width:999px;
height:980px;
margin:0 auto;
}
以下是我的媒體查詢代碼:
@media only screen and max-width 320px {
#container
{
width:98%;
background:url(images/1000_frameo.jpg) no repeat left;
margin-top:80px;
-webkit-background-size:contain;
-moz-background-size:contain;
-o-background-size:contain;
background-size:contain;
}
}