math.tan($number) returns the tangent of $number. Pass an angle whose units are compatible with deg, or a unitless number treated as radians. The result is a unitless ratio (rise over run / slope). Load it with @use "sass:math" on Dart Sass 1.25+.
Returns tangent as a unitless slope from an angle.
Unitless input = radians; prefer explicit deg when needed.
Same idea as sin/cos — prefer math.tan for slope intent.
Dart Sass 1.25+ via @use "sass:math".
One line: when an angle must become a fixed slope ratio in CSS, call math.tan($number).
Practice
Compile Notes
Practical checklist:
checklist.txt
1. @use "sass:math"
2. Pass deg-compatible angle or unitless radians
3. Expect a unitless slope ratio
4. Multiply by a run length when you need CSS rise
5. Use CSS tan() for runtime angles
Frequently Asked Questions
math.tan($number) returns the tangent of an angle. Example: math.tan(100deg) is about -5.6712818196; math.tan(1rad) and math.tan(1) are about 1.5574077247.
Add @use "sass:math"; then call math.tan($number). Requires Dart Sass 1.25+.
An angle compatible with deg (such as deg, rad, turn, grad), or a unitless number. Unitless values are treated as radians.
No. Tangent is a unitless ratio (rise over run). Multiply by a length if you need a CSS length, for example $run * math.tan(30deg).
Tangent is sin/cos. math.tan($a) matches math.div(math.sin($a), math.cos($a)) for the same angle (within floating-point precision). Prefer math.tan when you want the slope form.
Official docs expose this as math.tan() on sass:math. Prefer the module form with @use "sass:math".