Skip to content

Instantly share code, notes, and snippets.

@acidtone
Last active January 26, 2021 13:17
Show Gist options
  • Save acidtone/6aeb476a3c9bbc9788ce1ebc958b98d1 to your computer and use it in GitHub Desktop.
Save acidtone/6aeb476a3c9bbc9788ce1ebc958b98d1 to your computer and use it in GitHub Desktop.
Media queries: orientation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Portrait/Lanscape Orientation</title>
<style>
/* Set default styles. In this case, styles for portrait orientation (most likely mobile). */
body {
background-color: grey;
}
@media screen and (orientation: landscape) {
/* Override default styles (or declare new ones) when screen is wider than it is tall. */
body {
background-color: goldenrod;
}
}
</style>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment