Skip to Content
Pragmatic Guide to Sass 3
book

Pragmatic Guide to Sass 3

by Hampton Lintorn Catlin, Michael Lintorn Catlin
July 2016
Intermediate to advanced
130 pages
2h 11m
English
Pragmatic Bookshelf
Content preview from Pragmatic Guide to Sass 3
31Using @extend as a Mixin Alternative

In Task 8, Keeping Code Clean with Mixins, you learned about mixins—ways to apply one set of styles to another area of your code. There’s another way to achieve a similar outcome, and that’s by using @extend.

The @extend function extends any styles from a previous selector onto a new selector. So, say you had a .button class. You may want to copy those styles over to a different type of button. Just use @extend .button; in the new class and it works!

You might be wondering why you would use the @extend> function rather than a mixin. Don’t they just do the same thing? Well, not really. You’ll discover more of the differences in Task 33, Understanding the Dangers of @extend, but for now, here’s the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Jump Start Sass

Jump Start Sass

Hugo Giraudel, Miriam Suzanne
What Employees Want Most in Uncertain Times

What Employees Want Most in Uncertain Times

Kristine W. Powers, Jessica B.B. Diaz
Mastering Sass

Mastering Sass

Luke Watts

Publisher Resources

ISBN: 9781680502060Errata Page