CSS Data Type
Description
The <integer> CSS data type represents a numeric value without a fractional component. It is used in situations where only whole numbers make sense, such as counting repetitions, defining grid rows, or specifying iterations for animations. Unlike the <number> type, which allows decimals, <integer> strictly forbids fractions, ensuring precise, whole-number behavior in CSS calculations and property values.
One of the most common uses of <integer> is with the animation-iteration-count property, where it defines how many times an animation should repeat. Using a non-integer value in this context would cause an invalid value error. Similarly, it is used in properties such as z-index to control stacking order, where fractional numbers do not make sense.
The <integer> type is also commonly encountered when defining the number of columns in a CSS grid using grid-template-columns. Here, each column can be counted as a whole unit, ensuring proper alignment and layout. It is important to distinguish <integer> from types like <number> or <length>, which allow fractional or measurement-based values.
Code examples:
/* Animation repeating 3 times using <integer> */
@keyframes blink {
0% { opacity: 0; }
50% { opacity: 1; }
100% { opacity: 0; }
}
.element {
animation-name: blink;
animation-duration: 2s;
animation-iteration-count: 3; /* <integer> value */
}
/* Using <integer> in z-index */
.modal {
position: relative;
z-index: 10; /* <integer> value */
}
/* Grid with <integer> columns */
.grid-container {
display: grid;
grid-template-columns: repeat(4, 1fr); /* 4 is an <integer> */
}
The <integer> type ensures consistency wherever whole numbers are expected, making it a reliable choice for properties that depend on discrete values.
Syntax
property: <integer>;
Values
- <integer>Consists of one or several decimal digits, 0 through 9 inclusive, optionally preceded by a single + or - sign.
Example
Browser Support
The following information will show you the current browser support for the CSS integer data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.
This data type is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 2nd January 2026
