CSS Gradient Generator

Design stunning linear CSS gradients with interactive color pickers and live code outputs



function applyPreset() { const preset = document.getElementById('cggPresets').value; if (preset === 'custom') return;

const colors = { sunset: ["#ff7e5f", "#feb47b"], ocean: ["#2b5876", "#4e4376"], forest: ["#11998e", "#38ef7d"] };

document.getElementById('cggColor1').value = colors[preset][0]; document.getElementById('cggColor2').value = colors[preset][1]; updateGradient(); }

function copyGradient() { const el = document.getElementById('cggOutput'); el.select(); navigator.clipboard.writeText(el.value); alert('CSS gradient code copied!'); }

Understanding CSS Gradients

gradients allow you to display smooth transitions between two or more colors without loading heavy image assets, improving page load speeds and responsive styling.

How to Generate Gradients

  • Use Color 1 and Color 2 pickers to choose your transition palette.
  • Set the angle (in degrees) to control the direction of the gradient flow (e.g. 135 degrees for diagonal transitions).
  • Select from our preset palettes (Sunset, Ocean, Forest) for instant layout inspiration.