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

sakatagintoki
12,624 PointsTranslucent Gradients with CSS?
Is it possible to create translucent gradients with CSS?
I want to create an effect like this: https://www.icloud.com/
I opened up the dev tools and it seems the translucent gradient effect was created in something like photoshop and the image was applied as a background.
But is there any way to do this with CSS?
Thx ~Jay
1 Answer

Erik McClintock
45,783 PointsJay,
Yes, it is possible to create transparent gradients as overlays for images using just CSS.
<div>
<h1>Hello, I'm an h1 inside a div</h1>
</div>
div {
background: linear-gradient(rgba(255, 169, 73, .5), rgba(255, 255, 255, .5)),
url("path/to/an/image") no-repeat center;
background-size: cover;
}
The key here is to use rgba values for the colors in your gradient, which will allow you to control their transparency via their alpha value (the '.5' in this example).
Guil goes over some different CSS gradient examples in a few of the courses, I believe, but check out the one in the "Designing with the Latest Features" section of the CSS Basics Course for a quick, succinct rundown.
Erik