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

CSS3 calc(): ability to calculate on 'current' value

From: Eoghan Murray <eoghan@getthere.ie>
Date: Thu, 19 Sep 2013 18:57:32 +0100
Message-ID: <CABVdsenL=3AMzLyHVyJtuGe8k0y88mox9uH-=CSVjKOG1eYO2g@mail.gmail.com>
To: www-style@w3.org
I can do the following in CSS3:

    img { width: calc(66%); }

which is equivalent to doing:

    img { width: 66%; }

which resizes the image width to 66% of it's containing element.

What I'd like to be able to do is to be able to calculate based on the
current (i.e. default or auto) width of the image.
A syntax for this could be:

    img { width: calc(auto * 0.66); }

or just plain:

    img { width: calc(0.66); }

I think there is an omission here, as percentages cover very different
"The value may be that of another property for the same element, a property
for an ancestor element, or a value of the formatting context (e.g., the
width of a *containing block*)"

(Aside: transform: scale(0.66); doesn't have the effect I'm intending as it
doesn't alter layout)

With thanks!

Received on Friday, 20 September 2013 16:20:15 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:14 UTC