Web4College

CSS background-origin property

src

Description

CSS background-origin property specifies the position of background image with respect to different components of box model i.e. we define a point where we start measuring for the background position.


We position the image to top left corner.

Syntax

background-origin : border-box | padding-box | content-box

Property values

padding-boxDefault

The background image is positioned relative to the padding box.

See the background-image is behind the padding area.

background-origin: padding-box;
Try it

border-box

The background image is positioned relative to the border box.

See the background-image is behind the border area.

background-origin: border-box;
Try it

content-box

The background image is positioned relative to the content box.

See the background-image is behind the content area only.

background-origin: content-box;
Try it

Applicable to

It applies to all elements