Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,650 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/