calc()
apparently works in a transform, but this does not:
transform: scale(calc(0.75 + (0.3 - 0.75) * ((100vw - 320px) / (780 - 320))));
Also, this works, but it's basically the same formula, only with a percent vs decimal. Only added this so you can see the formula works here:
right: calc(30% + (75 - 30) * ((100vw - 320px) / (780 - 320)));
I have a container that has a width as a percent, and max width of 300px, for example. I want a child of it to always scale, using transform:scale()
, to a percent of the parent's actual current width.
Why does my transform calc
function not work? Using Chrome.
The 100vw - 320px
is there to calculate between minimum an max size of the window width. Is it possible to do that here?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…