0
我有一個樣式表,出於某種原因,我的媒體查詢沒有被檢測到。當我調整我的瀏覽器和Inspect Element
時,我仍然看到1060px .container
。未檢測到媒體屏幕?
這裏的樣式表
.container {
margin: 0 auto;
width: 1060px;
}
.container .section {
margin-top:40px;
width:320px;
margin-left:20px;
float:left;
height:480px;
position:relative;
}
/* Smartphones (portrait and landscape) */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
.container {
padding-left:2%;
margin: 0 auto;
width: 96%;
}
.container .section {
width:96%;
display:block;
position:relative;
}
}
如果您希望它在非移動設備上可見,請使用'min-width'而不是'min-device-width'。另外,確保你有一個視口集http://stackoverflow.com/questions/20874043/my-media-queries-arent-compatible-with-mobile-devices/20874068#20874068 –
謝謝。我能夠使這個簡單的改變工作! – guest