在Translate中使用CSS Calc函数

时间:2021-04-08 09:46:10

Currently I'm trying to use the CSS calc() function inside of a transform: translate, but I'm not having any luck.

目前我正在尝试在转换中使用CSS calc()函数:translate,但我没有任何运气。

transform: translate((calc(100vw/4))px, (calc(100vh/8))px) scale(1.333)

Is this nor possible, or is my syntax just all wrong here?

这也不可能,或者我的语法在这里完全错了吗?

2 个解决方案

#1


1  

From https://developer.mozilla.org/en-US/docs/Web/CSS/calc you need to mix values like this.

从https://developer.mozilla.org/en-US/docs/Web/CSS/calc您需要混合这样的值。

width: calc(100% - 80px);

#2


1  

Do you need to just fix the syntax? Like

你需要修复语法吗?喜欢

transform: translate(((calc(100vw/4))px), (calc(100vh/8))px) scale(1.333)

transform:translate((calc(100vw / 4))px),(calc(100vh / 8))px)scale(1.333)

#1


1  

From https://developer.mozilla.org/en-US/docs/Web/CSS/calc you need to mix values like this.

从https://developer.mozilla.org/en-US/docs/Web/CSS/calc您需要混合这样的值。

width: calc(100% - 80px);

#2


1  

Do you need to just fix the syntax? Like

你需要修复语法吗?喜欢

transform: translate(((calc(100vw/4))px), (calc(100vh/8))px) scale(1.333)

transform:translate((calc(100vw / 4))px),(calc(100vh / 8))px)scale(1.333)