CSS tan() function

Definition and usage

CSS's tan() The function returns the tangent value of the number.

The tangent value of an angle always returns a number between -∞ and ∞.

Example

Using tan() Calculate the width of the element:

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

CSS syntax

tan(angle)
Value Description
angle Required. Number or angle.

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
111 111 108 15.4 97

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

Reference:CSS sin() function

Reference:CSS sqrt() function