With this tool, you can generate cross-browser compatible CSS media queries for devices of all sizes like desktops, laptops, tablets, mobiles, landscape-portrait modes, media types, etc. (bookmark for quick reuse)
/* Mobile First i.e Smaller to Larger Devices */ /* X-Small devices (portrait phones, less than 576px) */ /* Small devices (landscape phones, 576px and up) */ @media (min-width: 576px) { ... } /* Medium devices (tablets, 768px and up) */ @media (min-width: 768px) { ... } /* Large devices (desktops, 992px and up) */ @media (min-width: 992px) { ... } /* X-Large devices (large desktops, 1200px and up) */ @media (min-width: 1200px) { ... } /* XX-Large devices (larger desktops, 1400px and up) */ @media (min-width: 1400px) { ... } /* Desktop First i.e Larger to Smaller Devices */ /* XX-Large devices (larger desktops) */ /* No media query since the xxl breakpoint has no upper bound on its width */ /* X-Large devices (large desktops, less than 1400px) */ @media (max-width: 1399.98px) { ... } /* Large devices (desktops, less than 1200px) */ @media (max-width: 1199.98px) { ... } /* Medium devices (tablets, less than 992px) */ @media (max-width: 991.98px) { ... } /* Small devices (landscape phones, less than 768px) */ @media (max-width: 767.98px) { ... } /* X-Small devices (portrait phones, less than 576px) */ @media (max-width: 575.98px) { ... }
CSS Media Queries Generator is a simple tool that you can use to generate media queries for your web-based projects to target web-browsers of devices of all sizes like desktops, laptops, tablets, mobiles, landscape-portrait modes, and media types.
What is the mobile-first approach in CSS Media Queries? - Mobile-first is when we start by writing our CSS for mobile devices and then use media queries to add in styling for larger screen sizes.
What is the desktop-first approach in CSS Media Queries? - Desktop-first is when we start by writing our CSS for desktop devices and then use media queries to add in styling for smaller screen sizes.
It is recommended to bookmark it on your web browsers to quickly revisit and reuse it when needed for better productivity at work.
Please share these tools with your friends and colleagues. Also, it will be great if you can recommend these tools in your blogs if you have one. Thank You :-)
Follow these simple steps to get the best results with this tool.
Step 1 - Click and select the media-query-labels from the right-side panel.
Step 2 - Copy the CSS by clicking the blue underlined button and apply it to your CSS files.
Now, save this tool or bookmark it on your web browser to revisit it quickly when needed. Thank you!
webdevpuneet.com © 2021 | hosted by Bluehost (web hosting)
/* ----------- Galaxy S3 ----------- */ /* Portrait and Landscape */ @media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 2) { } /* Portrait */ @media screen and (device-width: 320px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait) { } /* Landscape */ @media screen and (device-width: 320px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape) { } /* ----------- Galaxy S4, S5 and Note 3 ----------- */ /* Portrait and Landscape */ @media screen and (device-width: 320px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3) { } /* Portrait */ @media screen and (device-width: 320px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait) { } /* Landscape */ @media screen and (device-width: 320px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape) { } /* ----------- Galaxy S6 ----------- */ /* Portrait and Landscape */ @media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 4) { } /* Portrait */ @media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 4) and (orientation: portrait) { } /* Landscape */ @media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 4) and (orientation: landscape) { } /* ----------- HTC One ----------- */ /* Portrait and Landscape */ @media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3) { } /* Portrait */ @media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait) { } /* Landscape */ @media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape) { } /* ----------- Google Pixel ----------- */ /* Portrait and Landscape */ @media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3) { } /* Portrait */ @media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait) { } /* Landscape */ @media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape) { } /* ----------- Google Pixel XL ----------- */ /* Portrait and Landscape */ @media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 4) { } /* Portrait */ @media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 4) and (orientation: portrait) { } /* Landscape */ @media screen and (device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 4) and (orientation: landscape) { } /* ----------- Nexus 4 ----------- */ /* Portrait and Landscape */ @media screen and (device-width: 384px) and (device-height: 592px) and (-webkit-device-pixel-ratio: 2) { } /* Portrait */ @media screen and (device-width: 384px) and (device-height: 592px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait) { } /* Landscape */ @media screen and (device-width: 384px) and (device-height: 592px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape) { } /* ----------- Nexus 5 ----------- */ /* Portrait and Landscape */ @media screen and (device-width: 360px) and (device-height: 592px) and (-webkit-device-pixel-ratio: 3) { } /* Portrait */ @media screen and (device-width: 360px) and (device-height: 592px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait) { } /* Landscape */ @media screen and (device-width: 360px) and (device-height: 592px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape) { } /* ----------- Nexus 6 and 6P ----------- */ /* Portrait and Landscape */ @media screen and (device-width: 360px) and (device-height: 592px) and (-webkit-device-pixel-ratio: 4) { } /* Portrait */ @media screen and (device-width: 360px) and (device-height: 592px) and (-webkit-device-pixel-ratio: 4) and (orientation: portrait) { } /* Landscape */ @media screen and (device-width: 360px) and (device-height: 592px) and (-webkit-device-pixel-ratio: 4) and (orientation: landscape) { } /* ----------- Windows Phone ----------- */ /* Portrait and Landscape */ @media screen and (device-width: 480px) and (device-height: 800px) { } /* Portrait */ @media screen and (device-width: 480px) and (device-height: 800px) and (orientation: portrait) { } /* Landscape */ @media screen and (device-width: 480px) and (device-height: 800px) and (orientation: landscape) { } /* ----------- Non-Retina Screens ----------- */ @media screen and (-webkit-min-device-pixel-ratio: 1) { } /* ----------- Retina Screens ----------- */ @media screen and (-webkit-min-device-pixel-ratio: 2) and (min-resolution: 192dpi) { } /* ----------- iPad 1, 2, Mini and Air ----------- */ /* Portrait and Landscape */ @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 1) { } /* Portrait */ @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait) and (-webkit-min-device-pixel-ratio: 1) { } /* Landscape */ @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape) and (-webkit-min-device-pixel-ratio: 1) { } /* ----------- iPad 3, 4 and Pro 9.7" ----------- */ /* Portrait and Landscape */ @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 2) { } /* Portrait */ @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait) and (-webkit-min-device-pixel-ratio: 2) { } /* Landscape */ @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape) and (-webkit-min-device-pixel-ratio: 2) { } /* ----------- iPad Pro 10.5" ----------- */ /* Portrait and Landscape */ @media only screen and (min-device-width: 834px) and (max-device-width: 1112px) and (-webkit-min-device-pixel-ratio: 2) { } /* Portrait */ /* Declare the same value for min- and max-width to avoid colliding with desktops */ @media only screen and (min-device-width: 834px) and (max-device-width: 834px) and (orientation: portrait) and (-webkit-min-device-pixel-ratio: 2) { } /* Landscape */ /* Declare the same value for min- and max-width to avoid colliding with desktops */ @media only screen and (min-device-width: 1112px) and (max-device-width: 1112px) and (orientation: landscape) and (-webkit-min-device-pixel-ratio: 2) { } /* ----------- iPad Pro 12.9" ----------- */ /* Portrait and Landscape */ @media only screen and (min-device-width: 1024px) and (max-device-width: 1366px) and (-webkit-min-device-pixel-ratio: 2) { } /* Portrait */ /* Declare the same value for min- and max-width to avoid colliding with desktops */ @media only screen and (min-device-width: 1024px) and (max-device-width: 1024px) and (orientation: portrait) and (-webkit-min-device-pixel-ratio: 2) { } /* Landscape */ /* Declare the same value for min- and max-width to avoid colliding with desktops */ @media only screen and (min-device-width: 1366px) and (max-device-width: 1366px) and (orientation: landscape) and (-webkit-min-device-pixel-ratio: 2) { } /* ----------- Galaxy Tab 2 ----------- */ /* Portrait and Landscape */ @media (min-device-width: 800px) and (max-device-width: 1280px) { } /* Portrait */ @media (max-device-width: 800px) and (orientation: portrait) { } /* Landscape */ @media (max-device-width: 1280px) and (orientation: landscape) { } /* ----------- Galaxy Tab S ----------- */ /* Portrait and Landscape */ @media (min-device-width: 800px) and (max-device-width: 1280px) and (-webkit-min-device-pixel-ratio: 2) { } /* Portrait */ @media (max-device-width: 800px) and (orientation: portrait) and (-webkit-min-device-pixel-ratio: 2) { } /* Landscape */ @media (max-device-width: 1280px) and (orientation: landscape) and (-webkit-min-device-pixel-ratio: 2) { } /* ----------- Nexus 7 ----------- */ /* Portrait and Landscape */ @media screen and (device-width: 601px) and (device-height: 906px) and (-webkit-min-device-pixel-ratio: 1.331) and (-webkit-max-device-pixel-ratio: 1.332) { } /* Portrait */ @media screen and (device-width: 601px) and (device-height: 906px) and (-webkit-min-device-pixel-ratio: 1.331) and (-webkit-max-device-pixel-ratio: 1.332) and (orientation: portrait) { } /* Landscape */ @media screen and (device-width: 601px) and (device-height: 906px) and (-webkit-min-device-pixel-ratio: 1.331) and (-webkit-max-device-pixel-ratio: 1.332) and (orientation: landscape) { } /* ----------- Nexus 9 ----------- */ /* Portrait and Landscape */ @media screen and (device-width: 1536px) and (device-height: 2048px) and (-webkit-min-device-pixel-ratio: 1.331) and (-webkit-max-device-pixel-ratio: 1.332) { } /* Portrait */ @media screen and (device-width: 1536px) and (device-height: 2048px) and (-webkit-min-device-pixel-ratio: 1.331) and (-webkit-max-device-pixel-ratio: 1.332) and (orientation: portrait) { } /* Landscape */ @media screen and (device-width: 1536px) and (device-height: 2048px) and (-webkit-min-device-pixel-ratio: 1.331) and (-webkit-max-device-pixel-ratio: 1.332) and (orientation: landscape) { } /* ----------- Kindle Fire HD 7" ----------- */ /* Portrait and Landscape */ @media only screen and (min-device-width: 800px) and (max-device-width: 1280px) and (-webkit-min-device-pixel-ratio: 1.5) { } /* Portrait */ @media only screen and (min-device-width: 800px) and (max-device-width: 1280px) and (-webkit-min-device-pixel-ratio: 1.5) and (orientation: portrait) { } /* Landscape */ @media only screen and (min-device-width: 800px) and (max-device-width: 1280px) and (-webkit-min-device-pixel-ratio: 1.5) and (orientation: landscape) { } /* ----------- Kindle Fire HD 8.9" ----------- */ /* Portrait and Landscape */ @media only screen and (min-device-width: 1200px) and (max-device-width: 1600px) and (-webkit-min-device-pixel-ratio: 1.5) { } /* Portrait */ @media only screen and (min-device-width: 1200px) and (max-device-width: 1600px) and (-webkit-min-device-pixel-ratio: 1.5) and (orientation: portrait) { } /* Landscape */ @media only screen and (min-device-width: 1200px) and (max-device-width: 1600px) and (-webkit-min-device-pixel-ratio: 1.5) and (orientation: landscape) { } /* ----------- iPhone 4 and 4S ----------- */ /* Portrait and Landscape */ @media only screen and (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2) { } /* Portrait */ @media only screen and (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait) { } /* Landscape */ @media only screen and (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: landscape) { } /* ----------- iPhone 5, 5S, 5C and 5SE ----------- */ /* Portrait and Landscape */ @media only screen and (min-device-width: 320px) and (max-device-width: 568px) and (-webkit-min-device-pixel-ratio: 2) { } /* Portrait */ @media only screen and (min-device-width: 320px) and (max-device-width: 568px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait) { } /* Landscape */ @media only screen and (min-device-width: 320px) and (max-device-width: 568px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: landscape) { } /* ----------- iPhone 6, 6S, 7 and 8 ----------- */ /* Portrait and Landscape */ @media only screen and (min-device-width: 375px) and (max-device-width: 667px) and (-webkit-min-device-pixel-ratio: 2) { } /* Portrait */ @media only screen and (min-device-width: 375px) and (max-device-width: 667px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait) { } /* Landscape */ @media only screen and (min-device-width: 375px) and (max-device-width: 667px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: landscape) { } /* ----------- iPhone 6+, 7+ and 8+ ----------- */ /* Portrait and Landscape */ @media only screen and (min-device-width: 414px) and (max-device-width: 736px) and (-webkit-min-device-pixel-ratio: 3) { } /* Portrait */ @media only screen and (min-device-width: 414px) and (max-device-width: 736px) and (-webkit-min-device-pixel-ratio: 3) and (orientation: portrait) { } /* Landscape */ @media only screen and (min-device-width: 414px) and (max-device-width: 736px) and (-webkit-min-device-pixel-ratio: 3) and (orientation: landscape) { } /* ----------- iPhone X ----------- */ /* Portrait and Landscape */ @media only screen and (min-device-width: 375px) and (max-device-width: 812px) and (-webkit-min-device-pixel-ratio: 3) { } /* Portrait */ @media only screen and (min-device-width: 375px) and (max-device-width: 812px) and (-webkit-min-device-pixel-ratio: 3) and (orientation: portrait) { } /* Landscape */ @media only screen and (min-device-width: 375px) and (max-device-width: 812px) and (-webkit-min-device-pixel-ratio: 3) and (orientation: landscape) { } /* CSS Media Query for Media Type All */ @media all and (min-width: 1px){ ... } /* CSS Media Query for Media Type Print */ @media print and (min-width: 1px){ ... } /* CSS Media Query for Media Type Screen */ @media screen and (min-width: 1px){ ... } /* CSS Media Query for Media Type Speech */ @media speech and (min-width: 1px){ ... } /* CSS Media Query for Portrait Orientation */ @media screen and (max-device-width: 767px) and (orientation: portrait) { ... } /* CSS Media Query for Landscape Orientation */ @media screen and (max-device-width: 767px) and (orientation: landscape) { ... } /* CSS Media Query for iPad Pro */ /* Portrait and Landscape */ @media only screen and (min-width: 1024px) and (max-height: 1366px) and (-webkit-min-device-pixel-ratio: 1.5) { ... } /* Portrait */ @media only screen and (min-width: 1024px) and (max-height: 1366px) and (orientation: portrait) and (-webkit-min-device-pixel-ratio: 1.5) { ... } /* Landscape */ @media only screen and (min-width: 1024px) and (max-height: 1366px) and (orientation: landscape) and (-webkit-min-device-pixel-ratio: 1.5) { ... } /* Override all your hover rules for mobile devices */ @media (hover: none) { a:hover { color: inherit; } } /* Mobile First / Smaller to Larger */ /* X-Small devices (portrait phones, less than 576px) */ /* Small devices (landscape phones, 576px and up) */ @media (min-width: 576px) { ... } /* Medium devices (tablets, 768px and up) */ @media (min-width: 768px) { ... } /* Large devices (desktops, 992px and up) */ @media (min-width: 992px) { ... } /* X-Large devices (large desktops, 1200px and up) */ @media (min-width: 1200px) { ... } /* XX-Large devices (larger desktops, 1400px and up) */ @media (min-width: 1400px) { ... } /* Desktop First / Larger to Smaller */ /* X-Small devices (portrait phones, less than 576px) */ @media (max-width: 575.98px) { ... } /* Small devices (landscape phones, less than 768px) */ @media (max-width: 767.98px) { ... } /* Medium devices (tablets, less than 992px) */ @media (max-width: 991.98px) { ... } /* Large devices (desktops, less than 1200px) */ @media (max-width: 1199.98px) { ... } /* X-Large devices (large desktops, less than 1400px) */ @media (max-width: 1399.98px) { ... } /* XX-Large devices (larger desktops) */ /* No media query since the xxl breakpoint has no upper bound on its width */ /* Mobile First i.e Smaller to Larger Devices */ /* X-Small devices (portrait phones, less than 576px) */ /* Small devices (landscape phones, 576px and up) */ @media (min-width: 576px) { ... } /* Medium devices (tablets, 768px and up) */ @media (min-width: 768px) { ... } /* Large devices (desktops, 992px and up) */ @media (min-width: 992px) { ... } /* X-Large devices (large desktops, 1200px and up) */ @media (min-width: 1200px) { ... } /* XX-Large devices (larger desktops, 1400px and up) */ @media (min-width: 1400px) { ... } /* Mobile First i.e Smaller to Larger Devices */ /* X-Small devices (portrait phones, less than 576px), No need for media query here */ /* Mobile First i.e Smaller to Larger Devices */ /* Small devices (576px and up) */ @media (min-width: 576px) { ... } /* Mobile First i.e Smaller to Larger Devices */ /* Medium devices (tablets, 768px and up) */ @media (min-width: 768px) { ... } /* Mobile First i.e Smaller to Larger Devices */ /* Large devices (desktops, 992px and up) */ @media (min-width: 992px) { ... } /* Mobile First i.e Smaller to Larger Devices */ /* X-Large devices (large desktops, 1200px and up) */ @media (min-width: 1200px) { ... } /* Mobile First i.e Smaller to Larger Devices */ /* XX-Large devices (larger desktops, 1400px and up) */ @media (min-width: 1400px) { ... } /* Desktop First i.e Larger to Smaller Devices */ /* XX-Large devices (larger desktops) */ /* No media query since the xxl breakpoint has no upper bound on its width */ /* X-Large devices (large desktops, less than 1400px) */ @media (max-width: 1399.98px) { ... } /* Large devices (desktops, less than 1200px) */ @media (max-width: 1199.98px) { ... } /* Medium devices (tablets, less than 992px) */ @media (max-width: 991.98px) { ... } /* Small devices (landscape phones, less than 768px) */ @media (max-width: 767.98px) { ... } /* X-Small devices (portrait phones, less than 576px) */ @media (max-width: 575.98px) { ... } /* Desktop First i.e Larger to Smaller Devices */ /* XX-Large devices (larger desktops) */ /* No media query since the xxl breakpoint has no upper bound on its width */ /* Desktop First i.e Larger to Smaller Devices */ /* X-Large devices (large desktops, less than 1400px) */ @media (max-width: 1399.98px) { ... } /* Desktop First i.e Larger to Smaller Devices */ /* Large devices (desktops, less than 1200px) */ @media (max-width: 1199.98px) { ... } /* Desktop First i.e Larger to Smaller Devices */ /* Medium devices (tablets, less than 992px) */ @media (max-width: 991.98px) { ... } /* Desktop First i.e Larger to Smaller Devices */ /* Small devices (landscape phones, less than 768px) */ @media (max-width: 767.98px) { ... } /* Desktop First i.e Larger to Smaller Devices */ /* X-Small devices (portrait phones, less than 576px) */ @media (max-width: 575.98px) { ... }