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

Box Shadow Code Challenge problem

I'm having one devil of a time trying to answer the code challenge for this part. "Box Shadows"

Question:

Put A drop shadow 10px right, 10px down 5px for a spread radius, a color of: '#222' & 15 px-blur radius; I type it as follows:

My Code:

.box{
box-shadow:10px 10px 15px 5px rgb(2,2,2);
}

If I include the alpha channel in the rgb setting I separate with a comma, that doesn't work, if I put a '#' befor the color, that doesn't work either, I even tried switching the 15 & 5 around but I remember from the lesson that the blur radius goes B4 the spread radius, without a direct answer, what could I be doing wrong??

3 Answers

Mårten Björk
Mårten Björk
3,776 Points

Hi Chris! Your offset values (right, down) looks correct and so does your radius and spread values. The colors however seems strange. You don't have to convert the #222 value into a rgb color – you can just write: box-shadow: 10px 10px 15px 5px #222;

There are many ways of writing colors in CSS:

  • Hex codes: #222 or #ededed or #aaa
  • RGB values: rgb(255,150,5)
  • RGBA values: rgba(255,255,255,0.5)

And many more. Any of the above will work with box-shadow. Does this answer your question?

Thank you for that, I guess I overthought the answer. Many thanks this advice worked.

Wayne Priestley
Wayne Priestley
19,579 Points

everything seems in order, but its asking you to use a colour of #222 not a rgb (2,2,2)

alter your code and you should be good to go.

if you still have probs, paste the question, a link and you code so we can see it for ourselves and help you.

You got it Wayne. I overthought the answer. Many thanks, it worked.