W3C home > Mailing lists > Public > www-style@w3.org > April 2014

Re: Can we have more maths in calc()?

From: Liam R E Quin <liam@w3.org>
Date: Sun, 06 Apr 2014 15:55:10 -0400
Message-ID: <1396814110.14909.19.camel@localhost.localdomain>
To: Vasilis van Gemert <vasilis@vasilis.nl>
Cc: www-style@w3.org
On Sun, 2014-04-06 at 21:26 +0200, Vasilis van Gemert wrote:
> Hi,
> The last few days I’ve been playing with ratios to define layouts and
> font-sizes, as explained in this recent article on A List Apart:
> http://alistapart.com/article/content-out-layout

The article is not bad, although the ratio stuff is rather flawed
because it doesn't take margins/gutters into account.

Note that most attempts to do something similar with type sizes result
in spectacularly ugly results. You don't generally need larger sizes of
type for headings.

I agree about more functions being useful - for DSSSL years ago we added
(on my request I think) square roots and a couple of trigonometric
functions exactly for calculating page size ratios, for example using
the medieval constructs rediscovered by Jan Tschicholde.

> We could write something like this:
> div {
>     flex: calc(1.414 pow7) 1 calc(1.414px pow7);
> }

Although that's nice and compact, pow(1.414, 7) might be better when you
need to compose functions -
  calc( sqrt( sin( var( copywidth ) ) * var( pi ) * var( pageheight ) )
might be clearer than however you'd do it without the parens :)

The possibility of functions implemented in JavaScript seems not
unreasonable, too, e.g. to get access to the viewport size, or, via the
camera, the user's hair colour.


Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml
Received on Sunday, 6 April 2014 19:55:17 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:39 UTC