media query
@media only screen and (max-width: 600px) {
body {
background-color: lightblue;
}
}
media query
@media only screen and (max-width: 600px) {
body {
background-color: lightblue;
}
}
media query breakpoints
// Best Practice suggests
// keep default style for smallest screen size (portrait mobile, below 576px)
// and then proceed in assending order with media query like below
// Small devices (landscape phones, 576px and above till next break point)
@media (min-width: 576px) { ... }
// Medium devices (tablets, 768px and above till next break point)
@media (min-width: 768px) { ... }
// Large devices (desktops, 992px and above till next break point)
@media (min-width: 992px) { ... }
// so on ...
css media query responsive sizes
320px
480px
600px
768px
900px
1024px
1200px
CSS Media Queries for all Resolution
/* (320x480) iPhone (Original, 3G, 3GS) */
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
/* insert styles here */
}
/* (320x480) Smartphone, Portrait */
@media only screen and (device-width: 320px) and (orientation: portrait) {
/* insert styles here */
}
/* (320x480) Smartphone, Landscape */
@media only screen and (device-width: 480px) and (orientation: landscape) {
/* insert styles here */
}
/* (480x800) Android */
@media only screen and (min-device-width: 480px) and (max-device-width: 800px) {
/* insert styles here */
}
/* (640x960) iPhone 4 & 4S */
@media only screen and (min-device-width: 640px) and (max-device-width: 960px) {
/* insert styles here */
}
/* (720x1280) Galaxy Nexus, WXGA */
@media only screen and (min-device-width: 720px) and (max-device-width: 1280px) {
/* insert styles here */
}
/* (720x1280) Galaxy Nexus, Landscape */
@media only screen and (min-device-width: 720px) and (max-device-width: 1280px) and (orientation: landscape) {
/* insert styles here */
}
/* (1024x768) iPad 1 & 2, XGA */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
/* insert styles here */
}
/* (768x1024) iPad 1 & 2, Portrait */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait) {
/* insert styles here */
}
/* (1024x768) iPad 1 & 2, Landscape */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape) {
/* insert styles here */
}
/* (2048x1536) iPad 3 */
@media only screen and (min-device-width: 1536px) and (max-device-width: 2048px) {
/* insert styles here */
}
/* (1280x720) Galaxy Note 2, WXGA */
@media only screen and (min-device-width: 720px) and (max-device-width: 1280px) {
/* insert styles here */
}
/* (1366x768) WXGA Display */
@media screen and (max-width: 1366px) {
/* insert styles here */
}
/* (1280x1024) SXGA Display */
@media screen and (max-width: 1280px) {
/* insert styles here */
}
/* (1440x900) WXGA+ Display */
@media screen and (max-width: 1440px) {
/* insert styles here */
}
/* (1680x1050) WSXGA+ Display */
@media screen and (max-width: 1680px) {
/* insert styles here */
}
/* (1920x1080) Full HD Display */
@media screen and (max-width: 1920px) {
/* insert styles here */
}
/* (1600x900) HD+ Display */
@media screen and (max-width: 1600px) {
/* insert styles here */
}
how to combine two screen sizes in media queries css
@media (min-width: 30em) and (max-width: 50em) { ... }
screen sizes for css media
<meta name="viewport" content="width=device-width, initial-scale=1" />
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us