CSS Typed Object Model API
The upper read-only property of the CSSMathClamp interface returns a CSSNumericValue object representing its maximum value.
Value
A CSSNumericValue.
Examples
Basic usage
The following code creates a CSSMathClamp object, then reads its upper value.
const clamp = new CSSMathClamp(CSS.px(10), CSS.percent(50), CSS.px(500));
console.log(clamp.upper); // CSSUnitValue {value: 500, unit: "px"}
console.log(clamp.upper.value); // 500
console.log(clamp.upper.unit); // "px"
upper simply returns whatever CSSNumericValue was passed into the constructor — here that's a CSSUnitValue, since CSS.px(500) is a CSSUnitValue.
Passing a more complex expression, such as CSS.px(500).add(CSS.em(2)) (a CSSMathSum), means upper would return that CSSMathSum instead.
Specifications
Browser compatibility
See also
- CSSMathClamp.lower
- CSSMathClamp.value
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
