Sets the horizontal position of a background image.
Overview table0%
background-position-x: hAlignment
background-position-x: length
background-position-x: percentage
cm
, mm
, in
, pt
, or pc
) or a relative units designator (em
, ex
, or px
). For more information about the supported length units, see CSS Values and Units Reference.
Moving the background image to the right by 50px.
background-position-x: 50px;
Moving the background image to the left by 50px.
background-position-x: -50px;
Moving the background image to the right by half the width of its element.
background-position-x: 50%;
Moving the background image to the left by half the width of its element.
background-position-x: -50%;
Centering a background image inside its element.
background-position-x: center;
Usage
===Usage===
Windows Internet Explorer 8. The -ms-background-position-x attribute is an extension to CSS, and can be used as a synonym for background-position-x in IE8 Standards mode.
Although background-position-x is currently non-standard, Jonathan Snook provides a case for its inclusion regarding right-to-left languages, such as Arabic or Hebrew. When using sprites, developers would be able to accomodate LTR and RTL environments with a single line of code by including the background-position-x property, rather than redeclaring every single sprite’s position in their stylesheet. Read his blog entry on this and the background-position-y property.
background-position-x: length | percentage | hAlignment
There are no standards that apply here.
Related specifications[ ]
:
background-position-x
Microsoft Developer Network: [[1] Article]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4