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 Transparent Gradients and Multiple Backgrounds

Joey B
Joey B
5,275 Points

Is it possible to start a gradient with a slightly transparent color?

In the example, Guil goes from a solid orange color to a transparent color using the transparent keyword.

If I didn't want the solid color on top of my image, would it possible to start my gradient with a slightly transparent orange then fade to a full transparency?

1 Answer

Hi Joey,

Yes, you can by using the rgba() functional notation instead of specifying a hex code for the orange color.

With rgba(), you specify the red, green, and blue values as a decimal from 0 - 255 and then you specify the alpha value from 0 to 1 to indicate the transparency. 1 is fully opaque and 0 is fully transparent.

Example:

rgba(255, 169, 73, .3)

That would be 30% orange.

I used the converter here: http://hex.colorrrs.com/ to convert the hex code that Guil used in the video to decimal.

Joey B
Joey B
5,275 Points

Ah. I didn't think of that. I'm getting a bit overwhelmed by all these options :D Thanks for the link! Will definitely come in handy.