QuickDevGuide

Home › CSS

Colors, Gradients & Backgrounds — CSS

CSS offers multiple color formats: Hex (#ff0000), RGB (rgb(255, 0, 0)), and HSL (hsl(0, 100%, 50%)). HSL is the most human-readable because you can intuitively adjust hue (color), saturation (vibrancy), and lightness (brightness) independently. All formats support an alpha (transparency) channel: rgba(0, 0, 0, 0.8) for 80% opaque black. Modern CSS also accepts hex with alpha (#ff000080). Gradients Gradients create smooth color transitions: linear-gradient(to right, red, yellow) transitions along a line. radial-gradient(circle, white, blue) radiates from a center point. Conic gradients rotate around a center (useful for pie charts). Gradients can be used anywhere a color is accepted. Backgrounds The background property is a powerful shorthand combining color, image, repeat, position, and…

Key Takeaways