CSS round() function
- Previous Page CSS rotateZ() function
- Next Page CSS saturate() function
- Go Up One Level CSS Function Reference Manual
Definition and usage
CSS's round()
The function rounds the number to the nearest multiple of the rounding interval specified by the rounding strategy.
Example
Using round()
Round the number to the nearest multiple of the specified rounding interval according to the rounding strategy:
div.box2 { height: round(up, 105px, 25px); } div.box3 { height: round(down, 120px, 25px; } div.box4 { height: round(to-zero, 115px, 25px); }
CSS syntax
round(rounding-strategy, valuetoround, roundinginterval)
Value | Description |
---|---|
rounding-strategy |
Optional. Specify the rounding strategy. It can be one of the following values:
|
valuetoround | Required. The value to be rounded (number, percentage, size, or mathematical expression). |
roundinginterval | Required. Rounding interval (number, percentage, size, or mathematical expression). |
Technical details
Version: | CSS4 |
---|
Browser support
The numbers in the table represent the first browser version to fully support this function.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
125 | 125 | 118 | 15.4 | 111 |
Related pages
Reference:CSS acos() function
Reference:CSS asin() function
Reference:CSS atan() function
Reference:CSS atan2() function
Reference:CSS calc() function
Reference:CSS cos() function
Reference:CSS exp() function
Reference:CSS hypot() function
Reference:CSS log() function
Reference:CSS mod() function
Reference:CSS pow() function
- Previous Page CSS rotateZ() function
- Next Page CSS saturate() function
- Go Up One Level CSS Function Reference Manual