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!

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 CSS Basics (2014) Enhancing the Design With CSS Gradients

Jacob Tennyson
Jacob Tennyson
6,240 Points


I'm being asked to set a linear gradient with two color stops with a starting position from bottom to top but i must be putting in the code wrong because i cant figure it out. ive watched videos two times already and check for errors but i get nothing. Any recommendations?

/* Complete the challenge by writing CSS below */
  background-image: linear-gradient ( to top, steelblue,darkslateblue 90% );
<!DOCTYPE html>
    <title>Lake Tahoe</title>
    <link rel="stylesheet" href="page.css">
    <link rel="stylesheet" href="style.css">
    <header id="top" class="main-header">
      <span class="title">Journey Through the Sierra Nevada Mountains</span>
      <h1 class="main-heading">Lake Tahoe, California</h1>

        <div class="primary-content">
            <p class="intro">
                Lake Tahoe is one of the most breathtaking attractions located in California. It's home to a number of ski resorts, summer outdoor recreation, and tourist attractions. Snow and skiing are a significant part of the area's reputation.
            <a class="callout" href="#more">Find out more</a>
        </div><!-- End .primary-content -->

I think change this line to this to fix the problem

background-image: linear-gradient ( bottom, steelblue,darkslateblue 90% );

5 Answers

Hi Jacob,

No mistake you made, all is perfect except space between to top, it should be without space. See below

  background-image: ----;

You're adding an extra space after linear-gradient in the value declaration, which causes the gradient not to render. Try writing it out like this:

.main-header {
  background-image: linear-gradient(---);
28,736 Points

This question has already been asked some days ago, you can find the correct answer here.

This topic is bugged. My answer was originally accepted, but something happened to all the answers (as you can see, the values have been replaced with ----). Support has already confirmed the bug and that they are looking into it.

That said, the question you linked is actually a different question so the answer does not apply here.

28,736 Points

Ok I indeed thought these answers were quite odds. Thank you for the warning. Besides that, I linked the other topic because the subject is exactly the same. Both topics deal about the same exercise, and the answer marked as best answer works perfectly in the other one.I tested it. Or maybe I misunderstood something ?

The topic you linked is indeed about the same exercise, but not the same problem. As you can see in the answer I provided, Jacob's gradient wasn't rendering because he added an extra space in the value. In the thread you linked, Hazuki's gradient wasn't rendering because they added an unnecessary -webkit prefix to the value. :)

Jacob Tennyson
Jacob Tennyson
6,240 Points

Thanks guys, i figured it out.