过时
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.
y
特性为
CSSPositionValue
interface returns the item's position along the vertical axis.
var y = CSSPositionValue.y
A
CSSNumericValue
.
The following example positions a container
<div>
5 pixels from the top and 10 pixels from the left of the page.
let replaceEl = 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);
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
y
|
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.x
CSSPositionValue
x
y