CSS Backgrounds

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

With CSS you can set colors, gradients, and images as the background of an element.

It is possible to specify various combinations of images, colors, and gradients, and adjust the size, positioning, and repetition (among others) of these.

Syntax

  • background-color: color | transparent | initial | inherit;
  • background-image: url | none | initial | inherit;
  • background-position: value;
  • background-size: <bg-size> [<bg-size>]
  • <bg-size>: auto | length | cover | contain | initial | inherit;
  • background-repeat: repeat | repeat-x | repeat-y | no-repeat | initial | inherit;
  • background-origin: padding-box | border-box | content-box | initial | inherit;
  • background-clip: border-box | padding-box | content-box | initial | inherit;
  • background-attachment: scroll | fixed | local | initial | inherit;
  • background: bg-color bg-image position / bg-size bg-repeat bg-origin bg-clip bg-attachment initial | inherit;

Remarks

  • CSS3 gradients will not work on versions of Internet Explorer less than 10.


Got any CSS Question?