CSSbackground-repeat & origin & clip

background-repeat & origin & clip

Background-repeat controls whether background images tile. Background-origin controls where positioning starts. Background-clip controls what area the background covers.

Background Repeat

Value

Behavior

Use Case

repeat

Tile both directions

Patterns

repeat-x

Tile horizontally

Top/bottom borders

repeat-y

Tile vertically

Side borders

no-repeat

No tiling

Single images

space

Tile with spacing

Even distribution

CSS
/* Background repeat values */
.tile {
  background-repeat: repeat;
  /* Repeats in both directions */
}

.horizontal {
  background-repeat: repeat-x;
  /* Repeats horizontally */
}

.vertical {
  background-repeat: repeat-y;
  /* Repeats vertically */
}

.no-tile {
  background-repeat: no-repeat;
  /* Single image, no tiling */
}

.space {
  background-repeat: space;
  /* Evenly distributed */
}
Background Origin and Clip

CSS
/* Background origin */
.padding-box {
  background-origin: padding-box;
  /* Default: starts from padding edge */
}

.border-box {
  background-origin: border-box;
  /* Starts from border edge */
}

.content-box {
  background-origin: content-box;
  /* Starts from content edge */
}

/* Background clip */
.padding-clip {
  background-clip: padding-box;
  /* Clips to padding edge */
}

.border-clip {
  background-clip: border-box;
  /* Includes border */
}

.text-clip {
  background-clip: text;
  /* Clips to text shape */
  color: transparent;
}
Note
Background-repeat controls tiling. Background-origin/clip control area coverage. Use no-repeat for single images, repeat for patterns.
Next
Web fonts: [Web Fonts & @font-face](/css/web-fonts).