CSS log() Function
Example
Use log() to calculate widths:
div.a {
width: calc(log(50, 10) * 30px);
}
div.b {
width: calc(log(500) * 30px);
}
div.c {
width: calc(log(1000)
* 30px);
}
div.d {
width: calc(log(10000, 10) * 30px);
}
div.e {
width: calc(log(50000, 10) * 30px);
}
Try it Yourself »
Definition and Usage
The CSS log()
function returns the natural
logarithm (base E) of a specified number, or the logarithm of the number to the
specified base.
The constant E (2.718281828459045), is the base of natural logarithms.
Version: | CSS4 |
---|
Browser Support
The numbers in the table specify the first browser version that fully supports the function.
Function | |||||
---|---|---|---|---|---|
log() | 120 | 120 | 118 | 15.4 | 106 |
CSS Syntax
log(number, base)
Value | Description |
---|---|
number | Required. Specifies the number/value to calculate the logarithm for |
base | Optional. The logarithmic base to use. Default value is E (2.718281828459045) |
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 mod() function.
CSS reference: CSS pow() function.