When using the shorthand property the order of the property values is:



It does not matter if one of the property values is missing, as long as the other ones are in this order.

scroll | fixed | local

Sets whether a background image's position is fixed within the viewport, or scrolls with its containing block.

/* Keyword values */
background-attachment: scroll;
background-attachment: fixed;
background-attachment: local;

/* Global values */
background-attachment: inherit;
background-attachment: initial;
background-attachment: unset;

border-box | padding-box | content-box

/* Keyword values */
background-clip: border-box;
background-clip: padding-box;
background-clip: content-box;
background-clip: text;

/* Global values */
background-clip: inherit;
background-clip: initial;
background-clip: unset;

any color value

= | | | | | | currentcolor |


image = url | image() | image-set() | element() | cross-fade() | gradient

Issues here. See Moz page.





left top
left center
left bottom
right top        
right center                  
right bottom
center top
center center
center bottom
^^^---------- If there is no second argument then it's assumed to be "Center"
left top
left center
left bottom
right top        
right center                  
right bottom
center top
center center
center bottom
^^^---------- If there is no second argument then it's assumed to be
initial
inherit
contain
cover
xpos ypos

repeat | no-repeat | space | round | repeat-x | repeat-y

/* Keyword values */
background-repeat: repeat-x;
background-repeat: repeat-y;
background-repeat: repeat;
background-repeat: space;
background-repeat: round;
background-repeat: no-repeat;

contain | cover | px | %

Mozilla has a good Background-size demo

The background-size property is specified in one of the following ways:

  • Using the keyword values contain or cover.
  • Using a width value only, in which case the height defaults to auto.
  • Using both a width and a height value, in which case the first sets the width and the second sets the height. Each value can be a , a , or auto.
  • To specify the size of multiple background images, separate the value for each one with a comma.
/* Keyword values */
background-size: cover;
background-size: contain;

/* One-value syntax */
/* width (height becomes 'auto') */
background-size: 50%;
background-size: 3.2em;
background-size: 12px;
background-size: auto;

/* Two-value syntax */
/* first width, second  height */
background-size: 50% auto;
background-size: 3em 25%;
background-size: auto 6px;
background-size: auto auto;

/* Multiple backgrounds */
background-size: auto, auto;
/* Not to be confused with `auto auto` */
background-size: 50%, 25%, 25%;
background-size: 6px, auto, contain;

/* Global values */
background-size: inherit;
background-size: initial;
background-size: unset;

Formal definition

Initial valueas each of the properties of the shorthand:
Applies toall elements. It also applies to ::first-letter and ::first-line.
Inheritedno
Percentagesas each of the properties of the shorthand:
  • background-position: refer to the size of the background positioning area minus size of background image; size refers to the width for horizontal offsets and to the height for vertical offsets
  • background-size: relative to the background positioning area
Computed valueas each of the properties of the shorthand:
Animation typeas each of the properties of the shorthand:

Formal syntax3

background = 
<bg-layer>#? , <final-bg-layer>

<bg-layer> =
<bg-image> ||
<bg-position> [ / <bg-size> ]? ||
<repeat-style> ||
<attachment> ||
<visual-box> ||
<visual-box>

<final-bg-layer> =
<bg-image> ||
<bg-position> [ / <bg-size> ]? ||
<repeat-style> ||
<attachment> ||
<visual-box> ||
<visual-box> ||
<'background-color'>

<bg-image> =
<image> |
none

<bg-position> =
[ left | center | right | top | bottom | <length-percentage> ] |
[ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ] |
[ center | [ left | right ] <length-percentage>? ] && [ center | [ top | bottom ] <length-percentage>? ]



<bg-size> =
[ <length-percentage [0,∞]> | auto ]{1,2} |
cover |
contain

<repeat-style> =
repeat-x |
repeat-y |
[ repeat | space | round | no-repeat ]{1,2}

<attachment> =
scroll |
fixed |
local

<visual-box> =
content-box |
padding-box |
border-box

<image> =
<url> |
<gradient>

<length-percentage> =
<length> |
<percentage>

<url> =
<url()> |
<src()>

<url()> =
url( <string> <url-modifier>* ) |
<url-token>

<src()> =
src( <string> <url-modifier>