过时
This 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.
x
特性为
CSSPositionValue
interface returns returns the item's position along the web page's horizontal axis.
var x = CSSPositionValue.x
A
CSSNumericValue
.
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);
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
x
|
Chrome 66 | Edge 79 | Firefox No | IE No | Opera 53 | Safari No | WebView Android 66 | Chrome Android 66 | Firefox Android No | Opera Android 47 | Safari iOS No | Samsung Internet Android 9.0 |
完整支持
不支持
实验。期望将来行为有所改变。
CSSPositionValue.CSSPositionValue()
CSSPositionValue.y
CSSPositionValue
x
y