CSSPositionValue: y property
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{APIRef("CSS Typed Object Model API")}}{{Non-standard_header}}
The **y** property of the {{domxref("CSSPositionValue")}} interface returns the item's position along the vertical axis.
Value
A {{domxref('CSSNumericValue')}}.
Examples
Basic usage
The following example positions a container <div> 5 pixels from the top and 10 pixels from the left of the page.
js
let replaceEl = document.getElementById("container");
let position = new CSSPositionValue(CSS.px(5), CSS.px(10));
replaceEl.attributeStyleMap.set("object-position", position);
console.log(position.x.value, position.y.value);Browser compatibility
{{Compat}}
See also
- {{domxref("CSSPositionValue.CSSPositionValue", "CSSPositionValue()")}}
- {{domxref("CSSPositionValue.x")}}
- Using the CSS Typed OM
- CSS Typed Object Model API