CSS (Cascading Style Sheets) is a style sheet language used for describing the presentation of a document written in HTML (Hypertext Markup Language). CSS properties are used to style the HTML elements and make them visually appealing. One such property is background-origin.
Background-origin is a CSS property that specifies the origin position of the background image. It determines where the background image starts from. The background image can be positioned relative to the content box, padding box, or border box of an element. The default value of background-origin is padding-box.
The background-origin property is used to set the origin position of the background image. It determines the starting point of the background image. The background image can be positioned relative to the content box, padding box, or border box of an element. The three possible values of background-origin are:
The following code examples demonstrate the use of background-origin property:
.example {
background-image: url('example.jpg');
background-origin: content-box;
}
In this example, the background image will start from the upper-left corner of the content box of the element with class "example".
.example {
background-image: url('example.jpg');
background-origin: padding-box;
}
In this example, the background image will start from the upper-left corner of the padding box of the element with class "example".
.example {
background-image: url('example.jpg');
background-origin: border-box;
}
In this example, the background image will start from the upper-left corner of the border box of the element with class "example".
The background-origin property is used to set the origin position of the background image. It determines the starting point of the background image. The background image can be positioned relative to the content box, padding box, or border box of an element. The three possible values of background-origin are content-box, padding-box, and border-box.