![]() |
VOOZH | about |
The CSS tan() function returns the tangent of a specified angle in radians. In other words, it returns the ratio of the length of the opposite side to the length of the adjacent side in a right triangle. The value of the tangent will range between โinfinity and infinity.
Syntax of CSS type tan():
/* angle values */ width: calc(100px * tan(30deg)); width: calc(100px * tan(0.25turn)); width: calc(100px * tan(0.398163rad)); /* number values */ width: calc(100px * tan(0.73502)); width: calc(100px * tan(2.732 โ 1)); /* Other values */ width: calc(100px * tan(pi / 4)); width: calc(100px * tan(e / 2));
Parameter: The function takes one parameter:
Return value: The return value of the tan() function is a <number> value, representing the tangent of the specified angle.
Example 1: This example illustrates setting the skewness based on the tan value.
Output:
Example 2: This example illustrates the use of the tan() function to set the left of the element.
Output:
Supported browsers: The browsers supported by the tan() function are listed below: