CSS <number> Data Type
<number> data type represents real numbers, possibly with a fractional component.
<number> can include fractions, and it can also be immediately preceded by
- (negative sign) or
+ (positive sign) to indicate a negative or positive value respectively. A
<number> can also have an exponent composed of "e" or "E" and an integer.
So the following are all valid
When you see
<number> (including the
>) anywhere in the CSS specifications, this refers to the fact that the value can be any valid number.
For example, the official syntax for the
cubic-bezier() function looks like this:
Which means that you must pass four arguments of type
<number> to the function whenever you use it.
So you could do something like this:
Which will result in this:
The official definition for the
<number> type goes like this:
Number values are denoted by
<number>, and represent real numbers, possibly with a fractional component.
When written literally, a number is either an integer, or zero or more decimal digits followed by a dot (.) followed by one or more decimal digits and optionally an exponent composed of "e" or "E" and an integer. It corresponds to the
<number-token>production in the CSS Syntax Module [CSS3SYN]. As with integers, the first character of a number may be immediately preceded by
+to indicate the number's sign.
<number>data type is defined in CSS Values and Units Module Level 3 (W3C Candidate Recommendation, 29 September 2016)
- It is also defined in the Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification (W3C Recommendation 07 June 2011)
- It is also defined in Cascading Style Sheets, level 1 (W3C Recommendation 17 Dec 1996)