W3C home > Mailing lists > Public > www-style@w3.org > January 2013

Re: [css3-values] Predefined constants in calc() notation

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 18 Jan 2013 04:57:25 -0800
Message-ID: <CAAWBYDAwC3o-G_rgVZOmvO3EDN=3K4xZFrUQFr=RAr8HfWca3Q@mail.gmail.com>
To: Jan Tojnar <jtojnar@gmail.com>
Cc: www-style list <www-style@w3.org>
On Thu, Jan 17, 2013 at 3:44 PM, Jan Tojnar <jtojnar@gmail.com> wrote:
> Hi,
>
> I just made a beautiful rectangle using golden ratio but the following code
> doesn’t really look nice:
>
> calc(1.6180339887498948482*10em)
>
> I know I can define a custom variable and use it instead but prefefined
> constants (PHI, PI…) and functions (sqrt) would be better – compare:
>
> calc(phi*10em)

You don't really need that much precision - a simple 1.618 would have
been more than sufficient.

I'd hold off on adding more math primitives to calc() until we see a
real need.  Constants seem fairly low priority - for reasonable layout
purposes, you only need a few decimal places, and putting a simple
":root { var-phi: 1.618; } .foo { width: calc(var(phi) * 10em); }"
works fine.

~TJ
Received on Friday, 18 January 2013 12:58:12 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:04 GMT