CSS round() Function
Example
Use round() to round numbers according to the specified rounding-strategy, to the nearest integer multiple of rounding interval:
div.box2 {
height: round(up, 105px, 25px);
}
div.box3 {
height: round(down, 120px, 25px;
}
div.box4 {
height:
round(to-zero, 115px, 25px);
}
Try it Yourself »
Definition and Usage
The CSS round()
function returns a rounded
number according to the specified rounding-strategy, to the nearest integer
multiple of rounding interval.
Version: | CSS4 |
---|
Browser Support
The numbers in the table specify the first browser version that fully supports the function.
Function | |||||
---|---|---|---|---|---|
round() | 125 | 125 | 118 | 15.4 | 111 |
CSS Syntax
round(rounding-strategy, valuetoround, roundinginterval)
Value | Description |
---|---|
rounding-strategy | Optional. Specifies the rounding strategy. Can be one of the following
values:
|
valuetoround | Required. The value to be rounded (a number, percentage, dimension, or a mathematical expression) |
roundinginterval | Required. The rounding interval (a number, percentage, dimension, or a mathematical expression) |
Related Pages
CSS reference: CSS acos() function.
CSS reference: CSS asin() function.
CSS reference: CSS atan() function.
CSS reference: CSS atan2() function.
CSS reference: CSS calc() function.
CSS reference: CSS cos() function.
CSS reference: CSS exp() function.
CSS reference: CSS hypot() function.
CSS reference: CSS log() function.
CSS reference: CSS mod() function.
CSS reference: CSS pow() function.