coding3 min read

The Most Hated CSS Feature: Understanding tan()

Explore the reasons behind the disdain for tan() in CSS and learn how to use it effectively, or find simpler alternatives for your projects.

Kevin Liu profile picture

Kevin Liu

November 13, 2025

The Most Hated CSS Feature: Understanding tan()

Why Do Developers Dislike the tan() Function in CSS?

The CSS world is ever-changing, yet some features consistently irk developers. The "State of CSS 2025" survey highlights trigonometric functions, especially tan(), as the most disliked CSS feature. This might surprise those who see the elegance of math in coding. But, understanding the reasons behind the aversion to tan() can lead to better coding habits.

What Makes tan() Unpopular?

  • Limited Use Cases: Many developers find tan() has few practical applications in daily CSS tasks. It's useful for creating specific angles and rotations, but its infrequent use leads to confusion and frustration.
  • Complexity Over Simplicity: CSS aims to be simple. Introducing trigonometric functions adds unnecessary complexity for many, particularly those who prioritize practicality over mathematical exactness.
  • Lack of Familiarity: Trigonometric functions can intimidate developers without a strong math background, causing mistakes and avoidance of tan() in projects.

How Does tan() Function?

tan() calculates the tangent of an angle, a concept from trigonometry involving right triangle side ratios. In CSS, tan() helps manipulate angle-based values, mainly in transformations.

Example of tan() Usage

Consider this CSS snippet:

.element {
  transform: rotate(tan(45deg));
}

Here, the element rotates 45 degrees based on the angle's tangent. Yet, this example underscores a broader issue: developers often seek simpler, more intuitive methods for similar outcomes, bypassing trigonometric functions.

Exploring Alternatives to tan()

Facing the hurdles of using tan(), developers lean towards other strategies. Here are some alternatives:

  • CSS Grid and Flexbox: These tools offer easy solutions for layout and alignment without complex math.
  • Simpler Transformations: For rotations or translations, straightforward transformation properties may suffice.
  • JavaScript for Complex Math: For intricate calculations, using JavaScript to compute and apply styles might be more effective.

When Is tan() Useful?

Despite its unpopularity, tan() excels in certain situations:

  • Dynamic Animations: For animations needing precise angles, tan() is invaluable.
  • Geometric Designs: tan() simplifies calculations in angle-centric graphic design.
  • Custom Shapes: Creating shapes that require trigonometric calculations benefits from tan().

Conclusion

Though often labeled as the most disliked CSS feature, recognizing tan()'s utility and constraints allows developers to make smarter choices. While many goals are achievable through simpler means, knowing when to use tan() can refine CSS proficiency. Ultimately, whether you're a fan or critic of tan(), understanding its advantages and drawbacks is crucial for skilled CSS development.

Related Articles