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

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 UTC