如何使用calc()里面另一个函数 [英] How to use calc() inside another function

查看:128
本文介绍了如何使用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:

http://jsfiddle.net/qdJwY/1/

推荐答案

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

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.

更新:此处已报告为错误: https://code.google.com/p/chromium/issues/detail?id=150054

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

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆