background origin

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

CSS3 background-origin Property

Example

Let the background image start from the upper left corner of the content:

#example1 {
    background:url(img_flwr.gif);
    background-repeat: no-repeat;
    padding:35px;
    background-origin: content-box;

}

Definition and Usage

The background-origin property specifies where the background image is positioned.

CSS Syntax

background-origin: padding-box|border-box|content-box|initial|inherit;

Property Values

Value Description  
padding-box Default value. The background image starts from the upper left corner of the padding edge  
border-box The background image starts from the upper left corner of the border  
content-box The background image starts from the upper left corner of the content  
initial Sets this property to its default value. Read about initial  
inherit Inherits this property from its parent element. Read about inherit