Каковы наилучшие ширины для использования медиа-запросов для ориентации ориентации на портрете и ландшафт на разных устройствах? Существуют ли какие-либо стандарты?
Ширины для использования в медиа-запросах
Ответ 1
Я ищу повсюду лучший ответ для этого. Вот что я нашел.
@media (min-width:320px) { /* smartphones, iPhone, portrait 480x320 phones */ }
@media (min-width:481px) { /* portrait e-readers (Nook/Kindle), smaller tablets @ 600 or @ 640 wide. */ }
@media (min-width:641px) { /* portrait tablets, portrait iPad, landscape e-readers, landscape 800x480 or 854x480 phones */ }
@media (min-width:961px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:1281px) { /* hi-res laptops and desktops */ }
Я думаю, что лучше подумать о мобильном первом подходе. Начните с таблицы мобильных стилей, а затем примените мультимедийные запросы, релевантные для других устройств. Спасибо за @ryanve. Вот ссылка .
Ответ 2
Я нахожу, что это хорошие контрольные точки для начала, но всегда проверяйте и настраивайте, когда идете. Я также предлагаю использовать ems вместо px для измерений для различных размеров и разрешений устройства (причины, описанные здесь (http://blog.cloudfour.com/the-ems-have-it-proportional-media-queries-ftw/))
Таким образом, вышеупомянутые запросы будут выглядеть так:
@media (min-width:20em) { /* smartphones, iPhone, portrait 480x320 phones */ }
@media (min-width:30.063em) { /* portrait e-readers (Nook/Kindle), smaller tablets @ 600 or @ 640 wide. */ }
@media (min-width:40.063em) { /* portrait tablets, portrait iPad, landscape e-readers, landscape 800x480 or 854x480 phones */ }
@media (min-width:60.063em) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:64.063em) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:80.063em) { /* hi-res laptops and desktops */ }
Здесь также есть калькулятор с отличным пикселем в em (http://pxtoem.com/) Для вас это не так знакомо, в том числе и я.
Ответ 3
Попробуйте это, включая сетчатку
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
/* Styles */
}
/* Smartphones (portrait) ----------- */
@media only screen
and (max-width : 320px) {
/* Styles */
}
/* iPads (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) {
/* Styles */
}
/* iPads (landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) {
/* Styles */
}
/* iPads (portrait) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
/* Styles */
}
/* Desktops and laptops ----------- */
@media only screen
and (min-width : 1224px) {
/* Styles */
}
/* Large screens ----------- */
@media only screen
and (min-width : 1824px) {
/* Styles */
}
/* iPhone 4 ----------- */
@media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
/* Styles */
}
Ответ 4
Попробуйте этот медиа-запрос, это поможет вам
@media only screen and (min-width:1280px) {}
@media (min-width:1024px) and (max-width:1279px) {}
@media (min-width:768px) and (max-width:1023px) {}
@media (min-width:480px) and (max-width:767px) {}
@media screen and (max-width:479px) {}
@media only screen and (max-width:320px) {}
@media only screen and (max-width:767px) {}
Ответ 5
идеальный медиа-запрос
@media (max-width:400px) {}
@media (min-width:401px) and (max-width:599px) {}
@media (min-width:600px) and (max-width:767px) {}
@media (min-width:768px) and (max-width:950px) {}
@media (min-width:951px) and (max-width:1050px) {}
@media (min-width:1051px) {}
Ответ 6
Размеры экрана iPhone
-
iPhone 1-го поколения, 3G и 3GS = 320 x 480
-
iPhone 4 и 4S = 640 x 960
-
iPhone 5c и 5S = 640 x 1136
-
iPhone 6 = 750 x 1334
-
iPhone 6 Plus = 1080 x 1920 (понижен с оригинала 1242 x 2208)