Sass Tricks
Posted:
Tuesday, July 28th, 2015Last modified:
Tuesday, July 28th, 2015Topics:
SassUsing & with suffixed selectors
The & idiom simply concatenates the parent selector with whatever follows so the ampersand. This allows you to easily style classes like .error, .error--serious, error--not-serious like so:
Sass input
.error { color: red; &--serious { font-weight: 800; } &--not-serious { font-weight: 100; } }
CSS output
.error { color: red; } .error--serious { font-weight: 800; } .error--not-serious { font-weight: 100; }
Credit Bill C.
Available Wiki Topics
The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.