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

Color-stop issue with background image with a gradient...kinda

I have put a background image on the body element of my site and am trying to put a transparent linear-gradient over it. The image is from subtlepatterns.com and is a small image that repeats to fill the screen. When I add the gradient from top to bottom or bottom to top, I get what look like a repeating gradient, even though it is not supposed to be that way.

I've tried playing with repeat, size, and position on the image and the gradient, along with changing values and using browser prefixes, but have not been able to get it to be the way I want it (one color at the top of the screen transitioning to another color at the bottom, both transparent so the background shows through). I've done stuff similar to this before, but never had this issue.

Here is the code pen I've been working on: http://codepen.io/KitPepperwig/pen/pvrBrY

1 Answer

You're almost there! You just need to make sure to set the height of your html element to 100% (it wouldn't hurt to do the same to your body element as well).

html,
body {
  height: 100%;
}

Awesome!! If I was at home, I could have just looked at my other site I was working on and figured it out. I knew it was something simple I was missing.

No worries! It is an easy thing to forget.