CSS Animation Properties

backgroundbackground-colorbackground-imagebackground-positionbackground-sizeborderborder-bottomborder-bottom-colorborder-bottom-left-radiusborder-bottom-right-radiusborder-bottom-widthborder-colorborder-imageborder-image-outsetborder-image-sliceborder-image-sourceborder-image-widthborder-leftborder-left-colorborder-left-widthborder-radiusborder-rightborder-right-colorborder-right-widthborder-spacingborder-topborder-top-colorborder-top-left-radiusborder-top-right-radiusborder-top-widthborder-widthbottombox-shadowclipclip-pathcolorcolumn-countcolumn-gapcolumn-rulecolumn-rule-colorcolumn-rule-widthcolumn-widthcolumnsfilterflexflex-basisflex-growflex-shrinkfontfont-sizegapgridgrid-auto-columnsgrid-column-gapgrid-gapgrid-row-gapgrid-templategrid-template-columnsgrid-template-rowsheightleftletter-spacingline-heightmarginmargin-bottommargin-leftmargin-rightmargin-topmask-imagemask-positionmask-sizemax-heightmax-widthmin-heightmin-widthobject-positionopacityoutlineoutline-coloroutline-offsetoutline-widthpaddingpadding-bottompadding-leftpadding-rightpadding-topperspectiveperspective-originrightrow-gaptext-decorationtext-decoration-colortext-decoration-thicknesstext-indenttext-shadowtoptransformtransform-originvertical-alignwidthword-spacingz-index

CSS background-size animation property


with the background-size property you can animate background image size.

Values

This is the value you will use with background-size property

ValueDescription
autoDefault value. The background image is displayed in its original size
lengthSets the width and height of the background image to the specified length. The first value sets the width, and the second value set the height. If only one value is specified the second is assumed to be auto. Negative length values are not allowed.
percentageSets the width and height of the background image in percent of the parent element. The first value sets the width, the second value sets the height. If only one value is given, the second is set to "auto"
coverResize the background image to cover the entire container, even if it has to stretch the image or cut a little bit off one of the edges
containResize the background image to make sure the image is fully visible

Example


@keyframes myAnimation {
   from {
      
background-size
 
auto | length | cover | contain | initial
   }
   to {
      
background-size
 
auto | length | cover | contain | initial
   }
}
@keyframes myAnimation {
   0% {
      
background-size
 
auto | length | cover | contain | initial
   }
   100% {
      
background-size
 
auto | length | cover | contain | initial
   }
}

Multiple Values

@keyframes myAnimation {
   from {
      
background-size
 
auto | length | cover | contain | initial, ...n
   }
   to {
      
background-size
 
auto | length | cover | contain | initial, ...n
   }
}
@keyframes myAnimation {
   0% {
      
background-size
 
auto | length | cover | contain | initial, ...n
   }
   100% {
      
background-size
 
auto | length | cover | contain | initial, ...n
   }
}

References