background-position-x property
Specifies the horizontal coordinate of the background-image relative to the upper-left corner of the container object.
This property is not supported by all browsers, so use background-position property instead wherever you can.
JavaScript page for this property: backgroundPositionX. You can find other example(s) there. |
Possible values:
One of the following values:
Background is horizontally centered. | |||||||
Background is aligned to the left. | |||||||
The horizontal position of the background in length units. For the supported length units, see the length page. | |||||||
The horizontal position is the specified percentage of the width of the object. | |||||||
Background is aligned to the right. |
Default: 0%.
Example HTML code 1:
This example illustrates the use of the background-position-x property:
|
||||
<head> <style> .example { background-image: url("bg.jpg"); background-repeat: no-repeat; width: 200px; height: 200px; border:1px solid #CCCCCC; background-position-y: center; } .left { background-position-x: left; } .right { background-position-x: right; } </style> </head> <body> <div class="example left" style=" float:right;"> The image is at the left of this division. </div> <div class="example right"> The image is at the right of this division. </div> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by tags:
a, abbr, acronym, address, b, bdo, big, blockQuote, body, button, caption, center, cite, code, col, colGroup, dd, del, dfn, dir, div, dl, dt, em, 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:range, input:reset, input:search, input:submit, input:text, ins, isIndex, kbd, label, legend, li, listing, marquee, menu, nobr, ol, p, pre, q, rt, ruby, s, samp, small, span, strike, strong, sub, sup, table, tBody, td, textArea, tFoot, th, tHead, tr, tt, u, ul, var, xmp
Related pages:
background
background-attachment
background-color
background-image
background-position
background-position-y
background-repeat
background-attachment
background-color
background-image
background-position
background-position-y
background-repeat
External links:
User Contributed Comments