Skip to content

Instantly share code, notes, and snippets.

@acidtone
Last active January 26, 2021 17:08
Show Gist options
  • Save acidtone/0f9c31e820f29511fc2671063fd71c58 to your computer and use it in GitHub Desktop.
Save acidtone/0f9c31e820f29511fc2671063fd71c58 to your computer and use it in GitHub Desktop.
Media queries: max-width (open)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Desktop First: max-width</title>
<style>
/* Set default styles. In this case, styles for desktop. */
body {
background-color: grey;
}
/* Place medium screen media queries here, if needed. */
@media screen and (max-width: 40rem) {
body {
background-color: rebeccapurple;
}
}
/* Small screens */
@media screen and (max-width: 25rem) {
/* Override default styles (or declare new ones) when screen is narrower than 600px ("mobile"). */
body {
background-color: skyblue;
}
}
</style>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment