Gradians and Turns: the quiet heroes of CSS angles

Publikováno: 6.2.2019

I love coming across little overlooked CSS gems, like the gradien (grad) and turn (turn) units that Ken Bellows uncovers in his post explaining them. I don't know, maybe y'all are already aware of them, but they're certainly new to me.

They're additional options for dealing with angles, where degrees (deg) and radians (rad) are more commonly known. I'm partial to degrees anytime I'm working with rotations. But now that I know … Read article

The post Gradians and Turns: the quiet heroes of CSS angles appeared first on CSS-Tricks.

Celý článek

I love coming across little overlooked CSS gems, like the gradien (grad) and turn (turn) units that Ken Bellows uncovers in his post explaining them. I don't know, maybe y'all are already aware of them, but they're certainly new to me.

They're additional options for dealing with angles, where degrees (deg) and radians (rad) are more commonly known. I'm partial to degrees anytime I'm working with rotations. But now that I know there's an easier way to express a half rotation by using 0.5turn instead of 180deg, I can see myself reaching for turns much more often.

When you're designing an animation or thinking about how to add some rotation to your design, how are you thinking about it? You probably aren't thinking in numbers. ... You don't usually think in degrees or radians. You think in terms of full turns and portions of turns. At least, I do.

After looking at his table of comparisons, I take the point:

DegreesRadiansGradiansTurnsMy Fav Unit
30deg0.52rad33.33grad0.08turnGradians
45deg0.79rad50grad0.13turnGradians
60deg1.04rad66.67grad0.17turnGradians
90deg1.57rad100grad0.25turnTurns
180deg3.14rad200grad0.5turnTurns
360deg6.28rad400grad1turnTurns
720deg12.56rad800grad2turnTurns
1080deg25.12rad1200grad3turnTurns

Hear, hear! And since these units are supported back to IE 9, seems like something fun to try out.

(Hat tip to Rachel Andrew for sharing this in her awesome CSS Layout News email.)

Direct Link to ArticlePermalink

The post Gradians and Turns: the quiet heroes of CSS angles appeared first on CSS-Tricks.

Nahoru
Tento web používá k poskytování služeb a analýze návštěvnosti soubory cookie. Používáním tohoto webu s tímto souhlasíte. Další informace