CSS Backgrounds
Background Color
The background-color property sets the background color. Use
any CSS color value.
Linear Gradients
Create smooth color transitions with linear-gradient().
Specify direction and colors.
Radial Gradients
radial-gradient() creates circular or elliptical
gradients radiating from a center point.
Background Size
Control background image size with background-size:
cover, contain, or specific
dimensions.
Background Position
Position backgrounds with background-position:
keywords, percentages, or pixels.
Background Repeat
Control tiling with background-repeat:
repeat, no-repeat,
repeat-x, repeat-y.
background-size: cover for hero
sections to ensure the background always fills
the container while maintaining aspect ratio!
Summary
background-color- Solid background colorlinear-gradient()- Linear color transitionsradial-gradient()- Circular/elliptical gradientsbackground-size- cover, contain, or dimensionsbackground-position- Position the backgroundbackground-repeat- Control tiling behavior
Quick Quiz
Which background-size value ensures the image covers the entire container?
Enjoying these tutorials?