how to use mixin in css code example

Example 1: mixin for transition css

/* Mixin for transition css */
@mixin transition($for: all, $time-in: 250ms, $type: ease-in-out, $time-out: 0s) {
    transition: $for $time-in $type $time-out;
    -moz-transition: $for $time-in $type $time-out;
    -webkit-transition: $for $time-in $type $time-out;
    -o-transition: $for $time-in $type $time-out;
}

/* IE10 (the first stable version of IE to support transition)
does not require the -ms- prefix. */

Example 2: scss variables mixins

// _base.scss
$font-stack:    Helvetica, sans-serif;
$primary-color: #333;

body {
  font: 100% $font-stack;
  color: $primary-color;
}

Example 3: scss variables mixins

// styles.scss
@use 'base';

.inverse {
  background-color: base.$primary-color;
  color: white;
}

Tags:

Css Example