Mixins allow you to define styles that can be re-used throughout the stylesheet without needing to resort to non-semantic classes like .float-left
. Mixins can also contain full CSS rules, and anything else allowed elsewhere in a Sass document.
Mixins are defined with the @mixin
directive. It’s followed by the name of the mixin and optionally the arguments, and a block containing the contents of the mixin.
In the following example, the Mixin is included in the document with the @include
directive.
mixins.scss