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

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