Interactive online courses HTML Academy
2026-03-09 12:26 Diff

Two interesting, but little-explored values of the familiar property background-repeat, which is responsible for setting the background repeat property, are round and space.

The default property value of background-repeat: repeat simply repeats the background image across the entire width and height of the block. If parts of the repeating image do not fit within the width of the block, then they are simply cropped.

If you set the value to background-repeat: round, then the repeating images at the edges of the block will not be cropped, but will be evenly stretched or shrunk across the entire width and height to take up the remaining space.

By the way, background-repeat accepts two arguments as a value: one for the horizontal repeat mode and the other for vertical repeat mode. If you assign one parameter, then it will apply to both directions. For example:

/* Repeat the background using "repeat" horizontally and vertically */ background-repeat: repeat; /* Repeat the background using "round" horizontally and "repeat" vertically */ background-repeat: round repeat;

Let’s try out the round repeat mode.