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 in scss
$media-desktop: "only screen and (max-width : 1024px)";
$media-tablet: "only screen and (max-width : 768px)";
$media-mobile: "only screen and (max-width : 600px)";
$media-mobile-sm: "only screen and (max-width : 480px)";
@media #{$media-desktop} {
background: red;
}
@media #{$media-tablet} {
background: red;
}
@media #{$media-mobile} {
background: red;
}
@media #{$media-mobile-sm} {
background: red;
}
media queries scss
@mixin breakpoint($size) {
@if $size == mobile {
@media (max-width: 599px) { @content; }
} @else if $size == tablet-portrait-up {
@media (min-width: 600px) { @content; }
} @else if $size == tablet-landscape-up {
@media (min-width: 768px) { @content; }
} @else if $size == laptop-desktop {
@media (min-width: 992px) { @content; }
} @else if $size == extra-large-devices {
@media (min-width: 1200px) { @content; }
}
}
.header{
height: 10vh;
display: flex;
justify-content: space-between;
border-bottom: 2px solid black;
}
how to use media query scss
@mixin breakpoint($size) {
@if $size == mobile {
@media (max-width: 599px) { @content; }
} @else if $size == tablet-portrait-up {
@media (min-width: 600px) { @content; }
} @else if $size == tablet-landscape-up {
@media (min-width: 900px) { @content; }
} @else if $size == desktop-up {
@media (min-width: 1200px) { @content; }
} @else if $size == big-desktop-up {
@media (min-width: 1800px) { @content; }
}
}
/* used in this .scss file*/
.logo{
&__link{
&__img{
@include breakpoint(mobile) {
width:30%;
}
width:20%;
height:auto;
}
}
}
iphne media query csss
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) { /* STYLES GO HERE */}
media screen scss mixin
// respond is the name of your mixin
@mixin respond ($breakpoint) {
// $breakpoint is simply a variable that can have several values
@if $breakpoint==tablet {
// here `laptop` is the value of $breakpoint
// when call laptop, we mean the following piece of code
@media only screen and (max-width: 600px) {
@content;
}
}
@if $breakpoint==mobile {
@media only screen and (max-width: 480px) {
@content;
}
}
}
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