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 Add Reusable Logic to Your Sass Advanced Mixins Challenge

J Tan
J Tan
11,847 Points

Passing "1px solid" as mixin variable not passing challenge

I'm passing $size and $color: 1px solid as parameters for a mixin. But the Challenge still fails saying I need to set the border to 1px solid. What am I doing wrong?

@mixin square($size, $color: 1px solid) {
  height: $size;
  width: $size;
  border: $color black;

1 Answer

james south
.a{fill-rule:evenodd;}techdegree seal-36
james south
Front End Web Development Techdegree Graduate 33,271 Points

the only part of the border rule that is an argument to the mixin is color, the width and style are fixed here, so they go in the mixin body and will not be passed in. then when it asks to make black the default, that goes in the top line after the colon after $color. so now the mixin takes a size and a color, with black the default, then in the body, width and height are size, and the border will be 1px solid (color).