Backgrounds

๐ŸŽจ CSS3+ ๐ŸŸข Chapter 30 of 49 ๐Ÿ“‚ Phase 11: Backgrounds & Visual Effects ๐Ÿ“… 2026 Edition
๐Ÿ“Œ Covered in this chapter: background-color ยท background-image ยท background-size ยท background-position ยท background-repeat ยท background-attachment ยท Multiple Backgrounds ยท Gradients ยท Overlays
Welcome to Chapter 30: Backgrounds โ€” part of the CSS Complete Roadmap. This lesson covers all subtopics with clear explanations, code examples, and best practices used in professional web development.
1Background Properties
.hero {
  background-color: #1e293b;
  background-image: url('/images/hero.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}
  • background-size: cover โ€” fill container, crop if needed
  • background-size: contain โ€” full image visible
  • background-position โ€” top, center, 50% 30%, etc.
  • background-attachment: fixed โ€” parallax-like effect
2Multiple Backgrounds & Overlays
CSS
.hero-overlay {
  background:
    linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.7)),
    url('/images/hero.jpg') center / cover no-repeat;
  min-height: 60vh;
  color: #fff;
}

First listed background top layer โ€” gradient overlay image meeda render avuthundi.

OC
Written by Our Compiler Technical Editorial Team
Reviewed for accuracy ยท CSS Complete Roadmap ยท Last updated August 2026