Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Sass Basics!
You have completed Sass Basics!
Preview
Sass lets you reference the parent selector of a nested rule using the ampersand (&) symbol –– it's one of Sass' most useful features!
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
One of the best ways to use the ampersand
is with pseudo classes and pseudo elements
0:00
or when you're defining a set of class
names that share the same prefix.
0:02
The ampersand will help you write your
selectors in a less repetitive way and
0:06
keep them nicely organized under one rule.
0:10
Let's start with a simple example by
creating a rule that styles the anchor
0:13
elements on the page.
0:17
So, over in the base styles, I'll create
a rule that styles anchor tags and
0:20
I set their color to
the color primary variable,
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up