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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![MUZ140348 Sympathy Makururu](https://secure.gravatar.com/avatar/91f7b120488b40b666b5a7d5a38f8762?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
MUZ140348 Sympathy Makururu
10,209 PointsUse the mixin we just wrote to create a series of classes for the colors: red, orange, yellow, and green.
Use the mixin we just wrote to create a series of classes for the colors: red, orange, yellow, and green.
<!DOCTYPE html>
<html>
<head>
<title>Sass Basics - Code Challenge</title>
<link rel="stylesheet" type="text/css" href="page-style.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="box"></div>
<div class="red"></div>
<div class="orange"></div>
<div class="yellow"></div>
<div class="green"></div>
</body>
</html>
/* Write your SCSS code below. */
@mixin square($size, $color: black) {
height: $size;
width: $size;
border: 1px solid $color;
}
.box {
@include square($color:red, $size: 10px);
}
@include rainbow(.red .blue .green .yellow);
@mixin rainbow($colors...) {
@each $color in $colors {
.#{$color} {
background: $color;
}
}
}
2 Answers
![John Lukacs](https://uploads.teamtreehouse.com/production/profile-photos/3316802/micro_462223_172949522822498_1700631283_o.jpg)
John Lukacs
26,806 Points@include rainbow(.red .orange .yellow .green);
It does not work
![Boom San Chai](https://uploads.teamtreehouse.com/production/profile-photos/3704572/micro_1017389_10151529454143722_1473190411_n.jpg)
Boom San Chai
Courses Plus Student 9,304 PointsYou should put comma instead of dot.
@include rainbow(red, orange, yellow, green);