Using Media Queries to Target Different Screen Sizes
suggest changeOften, responsive web design involves media queries, which are CSS blocks that are only applied if a condition is satisfied. This is useful for responsive web design because you can use media queries to specify different CSS styles for the mobile version of your website versus the desktop version.
@media only screen and (min-width: 300px) and (max-width: 767px) {
.site-title {
font-size: 80%;
}
/* Applied when the viewport is at least 300px wide, and no more than 767px. */
}
@media only screen and (min-width: 768px) and (max-width: 1023px) {
.site-title {
font-size: 90%;
}
/* Applied when the viewport is at least 768px wide, and no more than 1023px. */
}
@media only screen and (min-width: 1024px) {
.site-title {
font-size: 120%;
}
/* Applied when the viewport is at least 1024px wide. */
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents