CSS · CSS Advanced · Lesson 43
CSS Gradients
Linear, radial and conic gradients.
CSS gradients let you display smooth transitions between two or more colors.
Example
<style>
div { height: 70px; margin-bottom: 10px; border-radius: 8px; color: white; padding: 8px; font-family: Arial; }
.l1 { background-image: linear-gradient(red, yellow); }
.l2 { background-image: linear-gradient(to right, #04AA6D, dodgerblue); }
.l3 { background-image: linear-gradient(45deg, red, orange, yellow, green, blue, indigo, violet); }
.r { background-image: radial-gradient(circle, yellow, green); }
.c { background-image: conic-gradient(red, yellow, green, blue, red); }
</style>
<div class="l1">linear top to bottom</div>
<div class="l2">linear to right</div>
<div class="l3">rainbow at 45deg</div>
<div class="r">radial</div>
<div class="c">conic</div>
Keep reading “CSS Gradients”
Sign up to read the full lesson, try every example in the live editor, and take the 5-question quiz.