CSS Property background-repeat

If a background image is nominative, the background-repeat property defines whether or not the image is continual (tiled), and how. continuation a background image happens once it’s been sized and positioned.

An image are often continual vertically, horizontally, each vertically and horizontally, or it are often set to not repeat in the least.

If a background image is continual, it’s going to happen that a {number of} its tiles get clipped if they don’t match a full number of times into the background positioning space of the part. before CSS3, there was nothing a developer might do to forestall that. however within the backgrounds and borders module level three, 2 new values are introduced that permit developers to forestall the image clipping by either rescaling that image in order that it fits a full variety of times, or continuation the image as usually because it can match among the world while not being clipped, so spacing the pictures dead set fill the world.

The property will take either one worth or 2 keyword values. The values specify whether or not and the way the image is continual horizontally and vertically.

If one single worth is employed, {the worth|the worth} is taken into account a shorthand for the two-value syntax and therefore the different value is about by the browser (see the Values section below for details). If 2 keyword values ar used, then the primary one is for the horizontal direction and therefore the second for the vertical direction.

The background-repeat property also can take comma-separated values in order that once the part has quite one background image, every worth is applied to a corresponding background image (first worth for the primary image, second worth for the second image, and so on).

CSS Property background-repeat Value

  • repeat-x
  • repeat-y
  • repeat
  • space
  • round
  • no-repeat

repeat-x

Computes to repeat no-repeat. The background image is recurrent horizontally however not vertically.

repeat-y

Computes to no-repeat repeat. The background image is perennial vertically however not horizontally.

repeat

Computes to repeat repeat. The background image is perennial each horizontally and vertically. this is often the default price.

space

Computes to house house. Spacing is additional between continual pictures on the horizontal axis still as on the vertical axis.

round

Computes to round round.

no-repeat

Computes to no-repeat no-repeat. The background image is not repeated at all.

Desktop Browser Support

Mobile Browser Support

Examples

.class{
    background-image: url(some/image.png);
    background-position: center center;
    background-repeat: repeat-y;
}
Leave a Reply