CSS background-repeat Property

❮ Previous Reference Next ❯

Example

body { 
  background-image: url("smiley.png");
  background-repeat: repeat-x;
}





Lorem Ipsum is simply dummy text of the printing and typesetting industry.

Lorem Ipsum is simply dummy text of the printing and typesetting industry.


Meaning

The background-repeat CSS property sets how background images are repeated. A background image can be repeated along the horizontal and vertical axes, or not repeated at all.

The background-repeat CSS property can also takes two values:

Single value Two-value equivalent
repeat-x repeat no-repeat
repeat-y no-repeat repeat
repeat repeat repeat
space space space
round round round
no-repeat no-repeat no-repeat


Default value:repeat
Inherited:No
Animatable:No
Version:CSS1
JavaScript syntax:
object.style.backgroundRepeat="repeat|repeat-x|repeat-y|no-repeat|space|round|initial|inherit|revert|revert-layer|unset";



Standard Syntax

background-repeat: repeat|repeat-x|repeat-y|no-repeat|space|round|initial|inherit|revert|revert-layer|unset;



Browser Support

The numbers in the table specify the first browser version that fully supports the property.




Status







Property Values

The following table describes the values of this property.

Value Description
repeat The default value. The background image will be repeated both vertically and horizontally.
repeat-x The background image will be repeated horizontally only.
repeat-y The background image will be repeated vertically only.
no-repeat The background image will not be repeated.
space The image is repeated as much as possible without clipping.
round As the allowed space increases in size, the repeated images will stretch (leaving no gaps) until there is room (space left >= half of the image width) for another one to be added.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element animation-delay property.
revert Reverts the cascaded value of the property from its current value to the value the property
revert-layer Rollback styles to the ones specified in previous cascade layers.
unset Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not.



Default CSS Property Values

selectors {
  background-repeat: repeat;
}
❮ Previous Reference Next ❯