CSS <integer> Data Type

The CSS <integer> data type denotes an integer number, positive or negative.

When you see <integer> (including the < and >) anywhere in the CSS specifications, this refers to the fact that the value can be a valid integer.

An integer consists of one or more decimal digits 0 through 9.

Integers can be immediately preceded by - to indicate a negative value, or + to indicate a positive value.

Here are examples of valid <integer> values:

Unit Identifiers

No unit identifiers are required with integers, however, a unit identifier may be required if the integer is part of another data type. For example, a <length> value might look like this:

However, in this case, the CSS specifications will state that the value must be a <length> (or whatever the value type is).

Also, strictly speaking, a <length> is a dimension, which is a <number> data type immediately followed by a unit identifier. The <number> data type allows a broader set of values than the <integer> type.

Fractional Components

You can't use a . (dot) within an integer, so you can't use values like 2.5 in places where only an <integer> data type is allowed.

However, the <number> data type does allow dots.

An <integer> Example

The column-count property accepts either of the following two values.

So you could write something like this:

Here's a working example:

CSS Specifications