CSS types.tan() Function Last Updated : 28 Apr, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report 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: angle: A angle value representing the angle in radians for which the tangent should be calculated.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. HTML <!DOCTYPE html> <html> <head> <style> .container { height: 200px; width: 200px; background-color: green; transform: rotate(45deg) skew(20deg) scale(1, tan(20deg)); } </style> </head> <body> <h1 style="color: green;"> GeeksforGeeks </h1> <h2>tan() function</h2> <div class="container"> </div> </body> </html> Output: Example 2: This example illustrates the use of the tan() function to set the left of the element. HTML <!DOCTYPE html> <html> <head> <style> .box { width: 100px; height: 100px; background-color: green; position: absolute; top: 50px; left: calc(30% + 50px * tan(30deg)); } </style> </head> <body> <h1 style="color: green;"> GeeksforGeeks </h1> <h2>tan() function</h2> <div class="box"> GeeksforGeeks </div> </body> </html> Output: Supported browsers: The browsers supported by the tan() function are listed below: Firefox 16.0Safari 15.4 Comment More infoAdvertise with us Next Article CSS types.tan() Function T taran910 Follow Improve Article Tags : Web Technologies CSS CSS-Functions Similar Reads CSS types.sin() Function The CSS sin() function is used to calculate the sine of an angle. The sine is a trigonometric function whose value ranges between -1 & 1. It is commonly used in mathematics and computer graphics to represent periodic behavior. In CSS, the sin() function can be used in calc() expressions to dynam 2 min read CSS types.atan() Function The trigonometric atan() CSS function returns the inverse tangent of a value between -â and +â. The single calculation in the function returns the number of radians that correspond to an angle between -90deg and 90deg. Syntax: /* numeric values */ transform: rotate(atan(-0.9)); transform: rotate(ata 2 min read CSS types.asin() Function The inverse sine of an integer between -1 and 1 is returned by the trigonometric asin() CSS function. The single computation in the function yields the number of radians that correspond to an angle between -90deg and 90deg. Syntax: /* numeric values */ transform: rotate(asin(-0.9)); transform: rotat 2 min read CSS types.acos() Function The trigonometric acos() function in the CSS gives the inverse cosine of a value between -1 and 1. The single computation in the function yields the number of radians that correspond to an angle between 0 and 180 degrees. Syntax: /* numeric values */ transform: rotate(acos(-0.5)); transform: rotate( 2 min read CSS types.atan2() Function The inverse tangent of two values between -infinity and infinity is returned by the trigonometric atan2() CSS function. The function returns the number of radians representing an angle between -180deg and 180deg and takes two arguments. Syntax: /* numeric values */ transform: rotate(atan2(5, 1)); /* 2 min read Like