Mixins


#1



https://www.codecademy.com/courses/learn-sass/lessons/mixins-and-parent-selector/exercises/multiple-arguments?action=lesson_resume


Could someone explain what exactly mixins are? Are they a set of attributes used to define a variable?



#2

A mixin allows us to create reusable chunks of CSS. Being able to do this helps us to avoid writing repetitive code.
Rather than having to re-write several times the same thing over and over, you define it once within a @mixin and then just include it whenever you need it, with @include.

For example, if you know that all your a:hover links throughout your site will be set a certain way, say with an underline, you define it once with a mixin and then include it where you need it.

This is part of the whole DRY (Don't Repeat Yourself) philosophy.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.