Web/API/CSSPositionValue/x

From Get docs

ObsoleteThis feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.


The x property of the CSSPositionValue interface returns returns the item's position along the web page's horizontal axis.

Syntax

var x = CSSPositionValue.x

Value

A CSSNumericValue.

Example

The following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page. 

let someDiv = document.getElementById('container');
let position = new CSSPositionValue(CSS.px(5), CSS.px(10));

someDiv.attributeStyleMap.set('object-position', position);
console.log(position.x.value, position.y.value);

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet

x

Experimental'

Chrome

Full support 66

Edge

Full support 79

Firefox

No support No

IE

No support No

Opera

Full support 53

Safari

No support No

WebView Android

Full support 66

Chrome Android

Full support 66

Firefox Android

No support No

Opera Android

Full support 47

Safari iOS

No support No

Samsung Internet Android

Full support 9.0

Legend

Full support  
Full support
No support  
No support
Experimental. Expect behavior to change in the future.'
Experimental. Expect behavior to change in the future.


See Also