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 Compass Basics Getting Started with Compass Getting Started with Compass

Patrick Noennig
Patrick Noennig
13,119 Points

Compass - Challenge task 2 of 5

Question

Next, use a mixin to give body a linear-gradient background. Make the start color #3d69b5 and the end color #1a335e.

Bummer! Make sure you're defining a linear-gradient.


My Solution

@mixin background($start, $stop) {
background:linear-gradient($start, $stop); }

body {
  @include background(#3d69b5, #1a335e);
}

Output in my stylesheet.css on my local compass

body {
  background: linear-gradient(#3d69b5, #1a335e);
}

Everything works fine on my local copy, what am I missing here. Thanks

2 Answers

Darren Kynaston
PLUS
Darren Kynaston
Courses Plus Student 15,610 Points
body {
  @include background(linear-gradient(#3d69b5, #1a335e));
}

Should work. As Chris stated the Compass Library already contains the mixin(s) required for this task and as in the video examples you have already linked the Compass Library .scss (sass files) into your project files so that you may call them in your markup (in this case with @include). That's why we use Compass - so we don't have to write all the common mixins etc... in our projects! =)

Chris Shaw
Chris Shaw
26,676 Points

Hi Patrick,

Compass has a built in mixin for linear and radial gradients therefore you don't need to create your own, see the following link for information about this mixins.

http://compass-style.org/examples/compass/css3/gradient/