CSSMathClamp: CSSMathClamp() constructor

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The CSSMathClamp() constructor creates a new CSSMathClamp object representing a CSS clamp() function.

Syntax

js
new CSSMathClamp(lower, value, upper)

Parameters

lower

A CSSNumericValue object – either a number or CSSUnitValue – representing the minimum value.

value

A CSSNumericValue object – either a number or CSSUnitValue – representing the preferred value.

upper

A CSSNumericValue object – either a number or CSSUnitValue – representing the maximum value.

Exceptions

TypeError

Thrown if there is a failure when adding the three arguments.

Examples

To do

Specifications

Specification
CSS Typed OM Level 1
# dom-cssmathclamp-cssmathclamp

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
CSSMathClamp() constructor
Chrome – Full support
Chrome 100 (Release date: 2022-03-29)
footnote Full support
Edge – Full support
Edge 100 (Release date: 2022-04-01)
footnote Full support
Firefox – No support
Firefox
footnote
footnote See bug 1278697
Opera – Full support
Opera 86 (Release date: 2022-04-20)
footnote Full support
Safari – Full support
Safari 16.4 (Release date: 2023-03-27)
footnote Full support
Chrome Android – Full support
Chrome Android 100 (Release date: 2022-03-29)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote
footnote See bug 1278697
Opera Android – Full support
Opera Android 69 (Release date: 2022-05-09)
footnote Full support
Safari on iOS – Full support
Safari on iOS 16.4 (Release date: 2023-03-27)
footnote Full support
Samsung Internet – Full support
Samsung Internet 19 (Release date: 2022-11-01)
footnote Full support
WebView Android – Full support
WebView Android 100 (Release date: 2022-03-29)
footnote Full support
WebView on iOS – Full support
WebView on iOS 16.4 (Release date: 2023-03-27)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.