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

Linear Gradients

I'm having problems with this exercise. "Set the second color stop's position to 90%. Then, add the value that sets the gradient direction from bottom to top."

So I write: .main-header { background-image: linear-gradient (at top, steelblue , darkslateblue 90%); }

But it says that it isn`t correct. What am I doing wrong?

Thanks

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

        <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.
            </p>
            <a class="callout" href="#more">Find out more</a>
        </div><!-- End .primary-content -->
  </body>
</html>

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You're doing great, but your syntax is a bit off here and there. In some cases, CSS is very picky about white space. Such is the case here. You have an extra space between linear-gradient and the first open parenthesis. Also, you're using the word at where you should be using to.

Take a look:

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

Hope this helps! :sparkles:

evan rost
PLUS
evan rost
Courses Plus Student 13,971 Points

Hello Christian, if you replace "at top" with "to top" or "0 deg" it should work. Also i got it to work without the semicolon after the linear gradient function.

this is the code i got it to pass with. .main-header{background-image: linear-gradient(to top, steelblue, darkslateblue 90%)}

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi Evan! I took the liberty of changing your comment to an answer. This not only marks the question as answered on the forums but also allows for voting on your answer. I actually composed my answer because I didn't immediately notice your comment. Thanks for helping in the Community! :sparkles:

evan rost
evan rost
Courses Plus Student 13,971 Points

is a semicolon required after the linear-gradient function?

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

evan rost In this case, no. If a selector only has a single rule, then the semicolon is not strictly required. That being said, it's considered best practice to end each rule with a semicolon. It's far too easy to start adding new rules and forget to add the semicolon to the previous one, which, of course, results in errors. :smiley: