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

Oğulcan Girginc
Oğulcan Girginc
24,848 Points

CSS Basics Gradients Code Challenge

Isn't both of them suppose to be correct? (Code challenge doesn't accept the second way as a right answer.)

Without 0%:

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

With 0%:

.main-header {
   background-image: linear-gradient(to top, steelblue 0%, darkslateblue 90%);
}
Italo Lemos
Italo Lemos
2,841 Points

Isn't necessary put "%" symbol when the set value is 0.

Oğulcan Girginc
Oğulcan Girginc
24,848 Points

I know, but that's not the question. :)

1 Answer

Hi Ogulcan,

The reason why it doesn't accept that answer, I believe, is that adding 0 with any unit is redundant when used for the first color stop unless specifying a different start point and the challenge doesn't tell you to add a 0 to the first color stop. And not to purposefully use circular logic, but the reason the challenge doesn't tell you to do that is because there's no need to put 0 as the first color stop. Also, Italo is right that there's no need for a unit for 0 value.