我想爲某些設備做一些響應修復。針對不同設備大小的書寫媒體查詢
例如對於Samsung Galaxy s5
,我需要更改一些代碼。
在chromes inspect element
,它顯示類似360px X 640px
。
現在我該如何編寫此設備的特定代碼?
對於iphone5
它顯示320px X 568px
。
我讀的地方,如果我寫這樣
@media only screen and (max-width: 766px) {
}
它會工作的所有設備,但是這似乎並不奏效。
所有這些設備的整體如何寫媒體查詢。
請建議。
編輯:所以第一條評論的網址後,這是我在做什麼
/* Portrait */
@media only screen
and (min-device-width: 375px)
and (max-device-width: 667px)
and (-webkit-min-device-pixel-ratio: 2)
and (orientation: portrait) {
margin-left: 30px;
}
但是,這是行不通的。
也許[這](https://開頭css-tricks.com/snippets/css/media-queries-for-standard-devices/)可以幫助 –
在此,什麼是將「風景」和「肖像」結合在一起,然後再將它們分開的原因? – Suraj
這是一個很好的觀察。不幸的是我沒有答案。我只能猜測這是一個全面的方法來覆蓋所有可能的設備和方向,但一個更受教育的答案肯定是需要的 –