Answers for "media quiry in scss"

CSS
4

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;
}
Posted by: Guest on February-21-2021
0

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; 
       } 
    }
}
Posted by: Guest on June-28-2021

Browse Popular Code Answers by Language