Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Sass Basics (retired) Variables, Mixins, and Extending Selectors Extending Selectors

What is use of %?

Hampton used %bar in second half of movie, instead of .bar, didn't understand the meaning of %?

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Ammar,

The % sign denotes a "Placeholder" instead of an actual selector. It is used in the @extend function. Hampton does a really good job of explaining placeholders and how/why they are used in the video. It starts at 2:40 and goes to 3:45. I recommend maybe rewatching that portion of the video.

Keep Coding! :)

Got it, thanks.

Alex Artigas Perucha
Alex Artigas Perucha
6,146 Points

I understand how @extend would be useful just leaving the main class as it is. In fact, the output is how I've been using regular css when I needed some repeated styles. But what I don't really get is changing it to a placeholder; what would be the difference of using a placeholder @extend and a regular @mixin then?

Alex Artigas Perucha
Alex Artigas Perucha
6,146 Points

Sorry, I posted this question with the video paused right before it explained itself. So it would be something more like a personal choice? Did I get it right?