Formation Prestashop intégrateur: Sass / @mixin - Les mixins avec paramètres

Vous êtes ici : Accueil / Prestashop intégrateur / Sass / @mixin - Les mixins avec paramètres


@mixin - Les mixins avec paramètres

Les mixins supportent l'utilisation de paramètres.

Exemple SCSS :


// mixins with parameters and default value
@mixin sexy-border($color, $width: 1in) {
  border: {
    color: $color;
    width: $width;
    style: dashed;
  }
}

// mixin with unknown number of arguments
@mixin box-shadow($shadows...) {
  -moz-box-shadow: $shadows;
  -webkit-box-shadow: $shadows;
  box-shadow: $shadows;
}

// mixin with unknown number of arguments and other mixin
@mixin bold-box-shadow($shadows...) {
  font-weight: bold;
  @include box-shadow($shadows...);
}