When to use @extend versus a mixin

Created on 2023-01-05T23:43:40-06:00

Return to the Index

This card pertains to a resource available on the internet.

This card can also be read via Gemini.

Use @extend for rules with explicit relationships and mixins for coincidental relationships.

An explicit relationship is something like a button, highlighted button, a disabled button.

A coincidental relationship is something like using the same color or font.

Microsoft browsers used to have a limit of 4095 selectors in a single CSS file.

@extend groups selectors together while mixins copy their body to each call site.