scss CSS响应切换器mixin

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scss CSS响应切换器mixin相关的知识,希望对你有一定的参考价值。

/*Define breakpoints  */
$sm: 568px;
$md: 768px;
$lg: 992px;
$xl: 1200px;

/* Responsive switcher */
@mixin respond($size) {

  @if $size == 'sm' {
    @media (min-width: $sm) {
      @content;
    }
  }
  @if $size == 'md' {
    @media (min-width: $md) {
      @content;
    }
  }
  @if $size == 'lg' {
    @media (min-width: $lg) {
      @content;
    }
  }
  @if $size == 'xl' {
    @media (min-width: $xl) {
      @content;
    }
  }

  /* Usage - include inline responsive styling in .scss files */
  @include respond(sm) { /* Styling here*/ };
  @include respond(md) {};
  @include respond(lg) {};
  @include respond(xl) {};
}

以上是关于scss CSS响应切换器mixin的主要内容,如果未能解决你的问题,请参考以下文章

javascript scss响应#css #scss #responsive #mixin

Scss mixins 可以响应吗

scss CSS-断点,mixins.scss

scss CSS-断点,mixins.scss

scss CSS-断点,mixins.scss

scss CSS-断点,mixins.scss