The '&' Operator

In this lesson, we'll be looking at the ampersand ('&') operator syntax.

We'll cover the following

Definition #

The ampersand & operator is often used when nesting in SASS and is an extremely useful feature.

It can be a great time-saver, especially if you happen to be coding your stylesheets with the BEM methodology, or using any systematic naming convention for your class names.

Example #

See the following HTML:

<button class = "btn btn--red"> Click me! </button>

Typical styling would be something like this:

Get hands-on with 1400+ tech skills courses.