Answers for "writing media queries sass"

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
2

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

Browse Popular Code Answers by Language