media query orientation code example
Example 1: media query
@media only screen and (max-width: 600px) {
body {
background-color: lightblue;
}
}
Example 2: css device orientation
@media screen and (orientation: portrait) {
#toolbar {
width: 100%;
}
}
@media screen and (orientation: landscape) {
#toolbar {
position: fixed;
width: 2.65em;
height: 100%;
}
p {
margin-left: 2em;
}
li + li {
margin-top: .5em;
}
}
Example 3: mediaquery for portrate
@media (orientation: portrait) {
body {
flex-direction: column;
}
}
Example 4: media query methods
1. @media print
{
p
{
font-family: georgia,montserrat;
}
}
2. <link rel="stylesheet" media="screen"
href="/css/screen_version.css">
3. @import "screenstyles.css" screen;