CSS <number> Data Type

Description

The <number> CSS data type is an integer or number containing digits from 0 to 9 and a decimal fraction, in which the integer and decimal part are separated by a decimal point. If the number starts from zero, then it can be omitted (.5 instead of 0.5).
Example of valid numbers are:
-7, 9.999999, -58.6, 236, -45, 200.00, 44.2376, -0.3, 0, 20e4.

Syntax

property: <number>;

Values

  • <number>A number can consist of the following: Digits 0 to 9, decimal point ( . ), addition ( + ), minus ( - ) or an exponent composed of "e" or "E" and an integer.

Example

<div>Hover over me...</div>
div {
    transition-property: width;
    transition-duration: 2s;
    transition-timing-function: cubic-bezier(.63,.05,.43,1.7);
    background: #634856;
    color: white;
    width: 140px;
    margin: 10px;
    padding: 10px;
}
div:hover {
    width: 80%;
}

Browser Support

Desktop
Explorer Edge Chrome Firefox Opera Safari
5121121
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
118410.111.0

Last updated by CSSPortal on: 8th December 2019