本文介绍了如何使用calc()在另一个函数内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以在 transform 或 calc() > translate ?
我似乎不能得到它的工作。这里是一个演示,所以你们可以玩:

Is it possible to use calc() inside of a CSS function like transform or translate?I cannot seem to get it working. Here is a demo so you guys can play around:

推荐答案

您可以使用 calc()无论你可以在CSS中使用基于长度的值。您提供的示例可以工作,但实际上最多为0.以下是稍微更改的演示:

You can use calc() wherever you can use a length based value in CSS. The example you have provided does work, but actually adds up to 0. Here is a slightly changed demo to illustrate: http://jsfiddle.net/joshnh/6ydR3/

此外,请务必最后列出未加前缀的版本。

Also, make sure to list the unprefixed version last.

在transform中的calc()函数中混合使用其他值类型的百分比似乎在Chrome中完全不起作用。

Mixing percentages with other value types in the calc() function within a transform doesn't seem to work at all in Chrome. I'll report this as a bug.

更新:此处已报告为错误:

UPDATE: This has been reported as a bug here: https://code.google.com/p/chromium/issues/detail?id=150054

这篇关于如何使用calc()在另一个函数内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 18:36