You can see the following
- Learning CSS
- Understanding responsive design
- Understanding media queries
Table of contents
Recommended by noknow
In order to make a responsive design, we need to consider what media query would be better.
There are many kind of devices and have different size. So "noknow" introduces our best practice for mobile first and PC first media query.
For mobile first
css
{
/* Smart phone (portrait) */
}
@media screen and (min-width: 500px) {
/* Smart phone (landscape) */
}
@media screen and (min-width: 768px) {
/* Tablet */
}
@media screen and (min-width: 1024px) {
/* PC */
}
@media screen and (min-width: 1200px) {
/* PC large */
}
For PC first
css
{
/* PC large */
}
@media screen and (max-width: 1199px) {
/* PC */
}
@media screen and (max-width: 1023px) {
/* Tablet */
}
@media screen and (max-width: 767px) {
/* Smart phone (landscape) */
}
@media screen and (max-width: 499px) {
/* Smart phone (portrait) */
}
Device list
Device | width x height (px) | resolution (px) | density | type |
---|---|---|---|---|
Apple iPhone 5 | 320 x 568 | 640 x 1136 | 2.0 | smartphone |
Apple iPhone 5S | 320 x 568 | 640 x 1136 | 2.0 | smartphone |
Apple iPhone SE | 320 x 568 | 640 x 1136 | 2.0 | smartphone |
Apple iPhone 6 | 375 x 667 | 750 x 1334 | 2.0 | smartphone |
Apple iPhone 6S | 375 x 667 | 750 x 1334 | 2.0 | smartphone |
Apple iPhone 7 | 375 x 667 | 750 x 1334 | 2.0 | smartphone |
Apple iPhone 8 | 375 x 667 | 750 x 1334 | 2.0 | smartphone |
Apple iPhone 6 Plus | 414 x 736 | 1080 x 1920 | 2.608 | smartphone |
Apple iPhone 6S Plus | 414 x 736 | 1080 x 1920 | 2.608 | smartphone |
Apple iPhone 7 Plus | 414 x 736 | 1080 x 1920 | 2.608 | smartphone |
Apple iPhone 8 Plus | 414 x 736 | 1080 x 1920 | 2.608 | smartphone |
Apple iPhone X | 375 x 812 | 1125 x 2436 | 3.0 | smartphone |
Apple iPhone XS | 375 x 812 | 1125 x 2436 | 3.0 | smartphone |
Apple iPhone 11 Pro | 375 x 812 | 1125 x 2436 | 3.0 | smartphone |
Apple iPhone XR | 414 x 896 | 828 x 1792 | 2.0 | smartphone |
Apple iPhone 11 | 414 x 896 | 828 x 1792 | 2.0 | smartphone |
Apple iPhone XS Max | 414 x 896 | 1242 x 2688 | 3.0 | smartphone |
Apple iPhone 11 Pro Max | 414 x 896 | 1242 x 2688 | 3.0 | smartphone |
Apple iPad 3 | 768 x 1024 | 1536 x 2048 | 2.0 | tablet |
Apple iPad 4 | 768 x 1024 | 1536 x 2048 | 2.0 | tablet |
Apple iPad 5 | 768 x 1024 | 1536 x 2048 | 2.0 | tablet |
Apple iPad 6 | 768 x 1024 | 1536 x 2048 | 2.0 | tablet |
Apple iPad Air 1 | 768 x 1024 | 1536 x 2048 | 2.0 | tablet |
Apple iPad Air 2 | 768 x 1024 | 1536 x 2048 | 2.0 | tablet |
Apple iPad Pro 9.7 | 768 x 1024 | 1536 x 2048 | 2.0 | tablet |
Apple iPad mini 3 | 768 x 1024 | 1536 x 2048 | 2.0 | tablet |
Apple iPad mini 4 | 768 x 1024 | 1536 x 2048 | 2.0 | tablet |
Apple iPad mini 7.9 | 768 x 1024 | 1536 x 2048 | 2.0 | tablet |
Apple iPad 10.2 | 810 x 1080 | 1620 x 2160 | 2.0 | tablet |
Apple iPad Pro 10.5 | 834 x 1112 | 1668 x 2224 | 2.0 | tablet |
Apple iPad Air 10.5 | 834 x 1112 | 1668 x 2224 | 2.0 | tablet |
Apple iPad Pro 12.9 | 1024 x 1366 | 2048 x 2732 | 2.0 | tablet |
Apple Watch Series 4 (40mm) | 197 x 162 | 394 x 324 | 2.0 | watch |
Apple Watch Series 4 (44mm) | 224 x 184 | 448 x 368 | 2.0 | watch |
Apple MacBook Pro 2019 16 inch | 1536 x 960 | 3072 x 1920 | 2.0 | PC |
Apple MacBook Air 2018 13 inch | 1280 x 800 | 2560 x 1600 | 2.0 | PC |
Apple MacBook Pro 2018 15 inch | 1440 x 900 | 2880 x 1800 | 2.0 | PC |
Apple MacBook Pro 2018 13 inch | 1280 x 800 | 2560 x 1600 | 2.0 | PC |
Apple MacBook Pro 2017 15 inch | 1440 x 900 | 2880 x 1800 | 2.0 | PC |
Apple MacBook Pro 2017 13 inch | 1280 x 800 | 2560 x 1600 | 2.0 | PC |
Google Nexus 4 | 384 x 640 | 768 x 1280 | 2.0 | smartphone |
Google Nexus 5 | 360 x 640 | 1080 x 1920 | 3.0 | smartphone |
Google Nexus 5X | 411 x 731 | 1080 x 1920 | 2.6 | smartphone |
Google Nexus 6 | 411 x 731 | 1440 x 2560 | 3.5 | smartphone |
Google Nexus 6P | 411 x 731 | 1440 x 2560 | 3.5 | smartphone |
Google Nexus 7 2012 | 600 x 960 | 800 x 1280 | 1.3 | tablet |
Google Nexus 7 2013 | 600 x 960 | 1200 x 1920 | 2.0 | tablet |
Google Nexus 9 | 768 x 1024 | 1536 x 2048 | 2.0 | tablet |
Google Nexus 10 | 800 x 1280 | 1600 x 2560 | 2.0 | tablet |
Google Pixel | 411 x 731 | 1080 x 1920 | 2.6 | smartphone |
Google Pixel XL | 411 x 731 | 1440 x 2560 | 3.5 | smartphone |
Google Pixel 2 | 411 x 731 | 1080 x 1920 | 2.6 | smartphone |
Google Pixel 2 XL | 411 x 823 | 1440 x 2560 | 3.5 | smartphone |
Google Pixel 3 | 411 x 823 | 1080 x 2160 | 2.625 | smartphone |
Google Pixel 3 XL | 411 x 846 | 1440 x 2960 | 3.5 | smartphone |
Google Pixel 3a | 411 x 846 | 1080 x 2220 | 2.625 | smartphone |
Google Pixel 3a XL | 411 x 846 | 1080 x 2160 | 2.625 | smartphone |
Google Pixel 4 | 411 x 869 | 1080 x 2280 | 2.625 | smartphone |
Google Pixel 4 XL | 411 x 869 | 1440 x 3040 | 3.5 | smartphone |
Huawei Y9s | 360 x 780 | 1080 x 2340 | 3.0 | smartphone |
Huawei Mate 30 Pro | 392 x 800 | 1176 x 2400 | 3.0 | smartphone |
Huawei Mate 30 | 360 x 780 | 1080 x 2340 | 3.0 | smartphone |
Huawei Mate 20 Pro | 360 x 780 | 1440 x 3120 | 4.0 | smartphone |
Huawei Mate 20 Lite | 360 x 780 | 1080 x 2340 | 3.0 | smartphone |
Huawei Watch GT | 227 x 227 | 454 x 454 | 2.0 | watch |
Huawei Watch Magic | 195 x 195 | 390 x 390 | 2.0 | watch |
Samsung Galaxy J7 | 360 x 640 | 720 x 1280 | 2.0 | smartphone |
Samsung Galaxy J7 Prime | 360 x 640 | 1080 x 1920 | 3.0 | smartphone |
Samsung Galaxy On8 | 360 x 640 | 1080 x 1920 | 3.0 | smartphone |
Samsung Galaxy S8 | 360 x 740 | 1440 x 2960 | 4.0 | smartphone |
Samsung Galaxy S8+ | 360 x 740 | 1440 x 2960 | 4.0 | smartphone |
Samsung Galaxy Note8 | 414 x 846 | 1440 x 2960 | 3.5 | smartphone |
Samsung Galaxy J6 | 360 x 740 | 720 x 1480 | 2.0 | smartphone |
Samsung Galaxy J8 | 360 x 740 | 720 x 1480 | 2.0 | smartphone |
Samsung Galaxy J7 Pro | 360 x 640 | 1080 x 1920 | 3.0 | smartphone |
Samsung Galaxy J5 | 360 x 640 | 720 x 1280 | 2.0 | smartphone |
Samsung Galaxy J5 Prime | 360 x 640 | 720 x 1280 | 2.0 | smartphone |
Samsung Galaxy J4 | 360 x 640 | 720 x 1280 | 2.0 | smartphone |
Samsung Galaxy S9 | 360 x 740 | 1440 x 2960 | 4.0 | smartphone |
Samsung Galaxy J7 Prime2 | 412 x 732 | 1080 x 1920 | 2.625 | smartphone |
Samsung Galaxy Watch | 240 x 240 | 360 x 360 | 1.5 | watch |
Samsung Galaxy Note9 | 414 x 846 | 1080 x 2960 | 3.5 | smartphone |
Samsung Galaxy A6s | 360 x 720 | 1080 x 2160 | 3.0 | smartphone |
Samsung Galaxy S9+ | 360 x 740 | 1440 x 2960 | 4.0 | smartphone |
Samsung Galaxy S10 | 360 x 760 | 1440 x 3040 | 4.0 | smartphone |
Samsung Galaxy S10+ | 412 x 869 | 1440 x 3040 | 3.5 | smartphone |
Sony XPERIA X | 360 x 640 | 1080 x 1920 | 3.0 | smartphone |
Sony XPERIA XZ | 360 x 640 | 1080 x 1920 | 3.0 | smartphone |
Sony XPERIA XA | 360 x 540 | 720 x 1080 | 2.0 | smartphone |