Our Guide To

CSS Gradients

Gradients are your tool in CSS to add multiple colors, often fading from on to another, to the background of elements in web design. This guide covers the different types of gradients that can be created with CSS, including examples that contain tips and tricks to get the most out of the syntax.

CSS Linear Gradient

Perhaps the most common type of gradient we see in web design is the linear-gradient(). It’s called “linear” because the colors flow from left-to-right, top-to-bottom, or at any angle you chose in a single direction.

CSS Radial Gradient

A radial gradient differs from a linear gradient in that it starts at a single point and emanates outward. Gradients are often used to simulate a light source, which we know isn’t always straight. That makes them useful to make the transitions between colors seem even more natural.

CSS Conic Gradient

A conic gradient is similar to a radial gradient. Both are circular and use the center of the element as the source point for color stops. However, where the color stops of a radial gradient emerge from the center of the circle, a conic gradient places them around the circle.

CSS Repeating Gradients

Repeating gradients take a trick we can already do with the creative use of color-stops on the linear-gradient() and radial-gradient() notations, and bakes it in for us. The idea is that we can create patterns out of the gradients we create and allow them to repeat infinitely. Related Posts …powered by Jetpack! The Jetpack WordPress […]

Radial Gradient Recipes

Radial gradients are pretty dang cool. It’s amazing we can paint the background of an element with them so easily. Easily is a relative term though. It’s certainly easier than needing to create a graphic in third-party software to use as the background, and the syntax is highly learnable. But it’s also not that easy […]

Transitioning Gradients

Keith J. Grant: In CSS, you can’t transition a background gradient. It jumps from one gradient to the other immediately, with no smooth transition between the two. He documents a clever tactic of positioning a pseudo element covering the element with a different background and transitioning the opacity of that pseudo element. You also need […]

Easing Linear Gradients

Linear gradients are easy to create in CSS and are extremely useful. As we’ll go through in this article, we can make them visually much smoother by creating them with non-linear gradients. Well, non-linear in the easing sense, anyway! Related Posts …powered by Jetpack! The Jetpack WordPress plugin runs on this site, powering not just […]

Using Conic Gradients and CSS Variables to Create a Doughnut Chart Output for a Range Input

I recently came across this Pen and my first thought was that it could all be done with just three elements: a wrapper, a range input and an output. On the CSS side, this involves using a conic-gradient() with a stop set to a CSS variable. Related Posts …powered by Jetpack! The Jetpack WordPress plugin […]