CSS tan() Function
Example
Use tan() to calculate the width of elements:
div.a {
width: calc(100px * tan(45deg));
}
div.b {
width: calc(100px * tan(0.125turn));
}
div.c {
width: calc(100px
* tan(0.5773502));
}
div.d {
width: calc(100px * tan(pi /
3));
}
Try it Yourself »
Definition and Usage
The CSS tan()
function returns the tangent
of a number.
The tangent of an angle will always return a number between -∞ and ∞.
Version: | CSS4 |
---|
Browser Support
The numbers in the table specify the first browser version that fully supports the function.
Function | |||||
---|---|---|---|---|---|
tan() | 111 | 111 | 108 | 15.4 | 97 |
CSS Syntax
tan(angle)
Value | Description |
---|---|
angle | Required. A number or an angle |
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.
CSS reference: CSS sin() function.
CSS reference: CSS sqrt() function.