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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 20 Sep 2013 12:07:12 -0700
Message-ID: <CAAWBYDB3ujzQaGm3DTdiWRZy4HADLEHoxxjyGcVLtdMMm2yYKA@mail.gmail.com>
To: Eoghan Murray <eoghan@getthere.ie>
Cc: www-style list <www-style@w3.org>
On Thu, Sep 19, 2013 at 10:57 AM, Eoghan Murray <eoghan@getthere.ie> wrote:
> 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
> ground:
> http://www.w3.org/TR/css3-values/#percentage-value
> "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)

What are you actually trying to do with something like this?  Do you
have examples?

~TJ
Received on Friday, 20 September 2013 19:07:58 UTC

This archive was generated by hypermail 2.3.1 : Friday, 20 September 2013 19:07:59 UTC