{
"$schema": "../schemas/code-crispies-module-schema.json",
"id": "css-gradients",
"title": "CSS Gradients",
"description": "Create smooth color transitions with CSS gradients.",
"difficulty": "intermediate",
"lessons": [
{
"id": "gradients-1",
"title": "Linear Gradient",
"description": "Gradients create smooth transitions between colors. The linear-gradient() function creates a gradient along a straight line.
Basic syntax:
background: linear-gradient(color1, color2);
Up to 50% off
background: linear-gradient(to right, blue, purple);", "task": "Make the gradient flow from left to right using to right.", "previewHTML": "", "previewBaseCSS": "body { font-family: system-ui, sans-serif; padding: 2rem; } .btn { padding: 1rem 2rem; border: none; border-radius: 8px; font-size: 1rem; font-weight: 600; color: white; cursor: pointer; }", "sandboxCSS": "", "codePrefix": ".btn {\n background: linear-gradient(", "initialCode": "", "codeSuffix": ", steelblue, mediumseagreen);\n}", "solution": "to right", "previewContainer": "preview-area", "validations": [ { "type": "contains", "value": "to right", "message": "Add to right to set the direction" } ] }, { "id": "gradients-3", "title": "Radial Gradient", "description": "The radial-gradient() function creates a gradient that radiates from a center point outward in a circular or elliptical pattern.
background: radial-gradient(circle, white, steelblue);