Basic example
example.css
transform: translateX(calc(sin(45deg) * 40px));
The sin() function returns the sine of an angle for advanced layout and animation math.
transform: translateX(calc(sin(45deg) * 40px));transform: translateX(calc(sin(45deg) * 40px));transform: translateX(calc(sin(45deg) * 40px));sin() is a modern CSS feature.
Supported in current major browsers with progressive enhancement.
Bottom line: Keep a readable fallback when using newer syntax.
Continue with cos().
CODETOFUN NEWS
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
2 people found this page helpful