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 Gradients: Color Stops

Nathan Brazil
PLUS
Nathan Brazil
Courses Plus Student 2,756 Points

Negative Values For Color Stops Has Interesting Effects

When I set a negative value for a color in a gradient it seems as though it reverses its flow or stop and start point. So this creates interesting effects when you have multiple colors in a radial gradient or use this with linear gradients with various degree angles . I tried setting the first color of a radial gradient to 20% then gave the second color a position value of 80% then finally I gave a third color a position of -100% making the color flow backwards which created a sharp change between the second and third colors instead of a smooth gradient. I also made a cool slash effect between two different gradients with the line of css below:

background-image: linear-gradient(35deg, #6633ff 0%, #3366ff 50%, #0099ff -100%);

I know I'm probably only scratching at the surface but thought this was cool. I wondered if you could make glossy looking buttons by giving them a sharp shadow or reflection line through the middle using this technique with linear gradients and adjusting the opacity?

1 Answer

Nice! Check out this gallery of some wild effects built with CSS gradients (including negative position values) for more inspiration :
http://lea.verou.me/css3patterns/

Jeremiah Shore
Jeremiah Shore
31,168 Points

These are really cool, thanks for the share!