-moz-background-origin property | -webkit-background-origin property
-moz-background-origin: | ||||||
-webkit-background-origin: |
Specifies how the background-position property is determined, i.e. it defines the reference point that the background-image is relative to.
JavaScript page for this property: MozBackgroundOrigin | webkitBackgroundOrigin. You can find other example(s) there. |
Possible values:
One of the following values:
The position is relative to the border. | |||||||
The position is relative to the content. | |||||||
Takes the value of this property from the computed style of the parent element. | |||||||
The position is relative to the padding. |
Default: border.
Example HTML code 1:
This example illustrates the use of the -moz-background-origin and the -webkit-background-origin properties:
|
||||
<head> <style> .bgOriginBorder { background-image: url("bg.jpg"); background-repeat: no-repeat; background-position: left top; width: 200px; height: 60px; padding: 10px; border: 8px solid #ffac84; -moz-background-origin: border; -webkit-background-origin: border; } .bgOriginPadding { background-image: url("bg.jpg"); background-repeat: no-repeat; background-position: left top; width: 200px; height: 60px; padding: 10px; border: 8px solid #ffac84; -moz-background-origin: padding; -webkit-background-origin: padding; } .bgOriginContent { background-image: url("bg.jpg"); background-repeat: no-repeat; background-position: left top; width: 200px; height: 60px; padding: 10px; border: 8px solid #ffac84; -moz-background-origin: content; -webkit-background-origin: content; } </style> </head> <body> <div class="bgOriginBorder"> background-origin: border </div> <br /> <div class="bgOriginPadding"> background-origin: padding </div> <br /> <div class="bgOriginContent"> background-origin: content </div> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by tags:
a, abbr, acronym, address, applet, b, bdo, big, blink, blockQuote, body, button, caption, center, cite, code, dd, del, dfn, dir, div, dl, dt, em, embed, fieldSet, font, form, H1, H2, H3, H4, H5, H6, hr, html, i, iframe, img, input:button, input:checkbox, input:file, input:image, input:password, input:radio, input:reset, input:submit, input:text, ins, isIndex, kbd, keygen, label, legend, li, marquee, menu, object, ol, optGroup, option, p, pre, s, samp, select, small, span, strike, strong, sub, sup, table, tBody, td, textArea, tFoot, th, tHead, tt, u, ul, var, input:range, input:search, q, tr, xmp
Related pages:
-moz-background-clip
-moz-background-inline-policy
background
background-attachment
background-color
background-image
background-position
background-repeat
-moz-background-inline-policy
background
background-attachment
background-color
background-image
background-position
background-repeat
External links:
-moz-background-origin (Mozilla Developer Center)
-webkit-background-origin (Safari Reference Library)
-webkit-background-origin (Safari Reference Library)
User Contributed Comments