CSS rem() function
- Previous Page CSS ray() function
- Next Page CSS repeat() function
- Go to the Previous Level CSS Function Reference Manual
Definition and usage
CSS rem()
The function returns the remainder after dividing one number (dividend) by another number (divisor).
Example: rem(9, 2) = 1. (9 / 2 = 4; 4 * 2 = 8, remainder = 1)
Example: rem(9, -2) = 1. (9 / -2 = 4; 4 * -2 = -8, remainder = -1)
Note:The result is always the sign of the divisor.
examples
Some rem()
Examples:
line-height: rem(9, 2); /* 1 */ line-height: rem(19, 4); /* 3 */ line-height: rem(3.5, 3); /* 0.5 */ padding: rem(9%, 2%); /* 1% */ padding: rem(19px, 4px); /* 3px */ padding: rem(19rem, 4rem); /* 3rem */ rotate: rem(120deg, 25deg); /* 20deg */ rotate: rem(120deg, -25deg); /* -20deg */ rotate: rem(-90deg, 15deg); /* 5deg */ rotate: rem(-90deg, -15deg); /* -5deg */
CSS syntax
rem(dividend divisor
Description | |
---|---|
dividend | Required. Dividend (number, percentage, or size value). |
divisor | Required. Divisor (number, percentage, or size value). |
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 ray() function
- Next Page CSS repeat() function
- Go to the Previous Level CSS Function Reference Manual