Starlit Daily

📚 › CSS: style and layout

7. Backgrounds

Este artículo se traducirá automáticamente. Por ahora se muestra en inglés.

background-color sets a plain colour. background-image uses a picture or a gradient, for example linear-gradient(...). background-size: cover fills the box, and background-position moves the picture.

A gradient needs no image file, so it loads quickly.

Ver ejemplo

.hero {
  background: linear-gradient(135deg, #7c9cff, #ff6bb5);
  color: white;
}

✍️ Ahora te toca

Give .hero a linear gradient from red to blue.

← Volver al curso