CSS Backgrounds

Background Properties

  • background-color: sets background color.
  • background-image: sets background image.
  • background-repeat: controls tile repetition.
  • background-position: sets image position.

Using Images as Backgrounds

Use background-image: url('image.jpg'); to load images.

Examples

body { background-color: #f0f0f0; }
div { background-image: url('bg.jpg'); background-repeat: no-repeat; background-position: center; }