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 trialScott Raymond
6,542 PointsTransparent Gradients
I have a background-image working fine but when I try and do the gradients I get nothing.
If I try and put all the background info in one "background" category like in the video, I suddenly lose my background image.
Here's my code if someone can explain what I am doing wrong. Thanks. If I do background: and then all the values Guil uses, I lose my image. But when I put my image path and no repeat and center all in one background: then I lose the background-image. So I know I missed something somewhere.
.main-header { text-align: center; padding-top: 170px; height: 850px; background-image: url('../img/armshigh.jpg'); background-repeat: no repeat; background-position: center; }
1 Answer
Uziel Cohen
4,318 PointsHi! Can you please write down the gradient code that you wish to apply to the background image? It should help the community understand what went wrong.
But, in short, i would suggest to use the example of the following code (since it works for me...) :
background: linear-gradient(0deg, #222, transparent 35%), linear-gradient(90deg, #222, transparent 68%), linear-gradient(180deg, #222, transparent 35%), linear-gradient(270deg, #222, transparent 68%), url('img/m26mod.jpg') no-repeat center;
Of course you should change the values as needed.
I hope it'll help. :)