CSS
The CSS
interface holds useful CSS-related methods. No objects with this interface are implemented: it contains only static methods and is therefore a utilitarian interface.
Properties
The CSS interface is a utility interface and no object of this type can be created: only static properties are defined on it.
Static properties
-
CSS.paintWorklet
Secure context -
Provides access to the Worklet responsible for all the classes related to painting.
Methods
The CSS interface is a utility interface and no object of this type can be created: only static methods are defined on it.
Static methods
No inherited static methods.
CSS.registerProperty()
-
Registers
custom properties
, allowing for property type checking, default values, and properties that do or do not inherit their value. CSS.supports()
-
Returns a
Boolean
indicating if the pair property-value, or the condition, given in parameter is supported. CSS.escape()
-
Can be used to escape a string mostly for use as part of a CSS selector.
CSS factory functions
-
Can be used to return a new
CSSUnitValue
with a value of the parameter number of the units of the name of the factory function method used.CSS.em(3) // CSSUnitValue {value: 3, unit: "em"}
Specifications
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
CSS |
28 |
12 |
22 |
No |
12.1 |
10 |
4.4 |
28 |
22 |
12.1 |
Yes |
1.5 |
Hz |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
Q |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
ch |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
cm |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
deg |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
dpcm |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
dpi |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
dppx |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
em |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
escape |
46 |
79 |
31 |
No |
33 |
10 |
46 |
46 |
31 |
33 |
10 |
5.0 |
ex |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
fr |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
grad |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
ic |
No
See bug 778495.
|
No |
No
See bug 1531223.
|
No |
No |
No
See bug 195176.
|
No |
No |
No |
No |
No |
No |
in |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
kHz |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
lh |
No
See bug 937104.
|
No |
No
See bug 1310170.
|
No |
No |
No |
No |
No |
No |
No |
No |
No |
mm |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
ms |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
number |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
paintWorklet |
65 |
79 |
No |
No |
52 |
No |
65 |
65 |
No |
47 |
No |
9.0 |
pc |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
percent |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
pt |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
px |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
rad |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
registerProperty |
78 |
79 |
No |
No |
65 |
No |
78 |
78 |
No |
No |
No |
12.0 |
rem |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
rlh |
No
See bug 937104.
|
No |
No
See bug 1310170.
|
No |
No |
No |
No |
No |
No |
No |
No |
No |
s |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
supports |
61
28
Version 60 or older didn't support parentheses-less one-argument version.
|
12
Edge doesn't support parentheses-less one-argument version.
|
55
22
Version 54 or older didn't support parentheses-less one-argument version.
|
No |
12.1 |
10 |
61
37
Version 60 or older didn't support parentheses-less one-argument version.
|
61
28
Version 60 or older didn't support parentheses-less one-argument version.
|
55
22
Version 54 or older didn't support parentheses-less one-argument version.
|
12.1 |
Yes |
8.0
1.5
Samsung Internet 8.0 or older didn't support parentheses-less one-argument version.
|
turn |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
vb |
No
See bug 778495.
|
No |
No
See bug 1287034.
|
No |
No |
No
See bug 159801.
|
No |
No |
No |
No |
No |
No |
vh |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
vi |
No
See bug 778495.
|
No |
No
See bug 1287034.
|
No |
No |
No
See bug 159801.
|
No |
No |
No |
No |
No |
No |
vmax |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
vmin |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
vw |
66 |
79 |
No |
No |
53 |
No |
66 |
66 |
No |
47 |
No |
9.0 |
See also
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/CSS