CodeFinity
CodeFinity

Reputation: 1350

Why Can't I Combine CSS-Transform with CSS Calc?

transform-origin: calc(100% - (44px / 2)) 44px / 2;

It seems to invalidate things and just makes it regress to default transform-origin: center.

The point is that I need to 'responsively' calculate the x-offset of transform-origin somehow.

Upvotes: 0

Views: 63

Answers (2)

CodeFinity
CodeFinity

Reputation: 1350

Here's what ended up working:

transform-origin: calc(100% - #{$hit-area} / 2) ($hit-area / 2);

Upvotes: 0

Sam Uyemura
Sam Uyemura

Reputation: 37

If the last 44px / 2 wasn't a typo, delete that. That is outside the calc(). If it is a typo, can you give us some more code? Some html would be nice.

Heres a JSFiddle

Upvotes: 1

Related Questions