Grokking CSS for Web Development
Vote

0% completed

​

Background Properties (color, image, repeat)

Every element has a background: the area behind its content, its padding, and its border, which stays empty until you paint it. Three properties control that area. background-color fills it with one color, background-image places an image in it, and background-repeat decides whether the image is drawn once or tiled to fill the space.

The running example

This page continues the travel card from the previous lesson. The card now gets a cream color and a small orange dot as its background image.

<!DOCTYPE html> <html> <head> <title>Card Background</title> <style>

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content