Backgrounds
Shorthand property to set all background style properties like color, image, position, and repeat in a single declaration.
Understanding Backgrounds in HTML & CSS
What it does: The rgba function sets Red, Green, Blue, and an Alpha transparency layer between 0 and 1. background-position: center automatically aligns the graphic vertically and horizontally. The background shorthand combines color, image, position, size, and repeat into a single line. CSS uses the url() function to point to image sources for backgrounds. cover fills the element completely, cropping if needed, while contain ensures the whole image is visible without cropping. Background colors are layered behind background images, serving as a fallback if the image fails to load. Setting background-repeat to no-repeat stops the default horizontal and vertical tiling behavior. The contain value guarantees that no parts of the background image are cut off or hidden.
Common mistakes: Line 1 is incorrect because background-image values must be wrapped inside a url() function, not as a raw string. Line 2 is incorrect because repeat-yes is invalid. Use repeat, no-repeat, repeat-x, or repeat-y.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 53–63) and word search (Modules 43–63).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
backgroundFill in the Blanks
Spot the Error
Student with a class code? Join your class →