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

Re: [cssom] CSS Value API

From: Brad Kemper <brad.kemper@gmail.com>
Date: Thu, 22 Apr 2010 08:56:23 -0700
Cc: "Boris Zbarsky" <bzbarsky@mit.edu>, François REMY <fremycompany_pub@yahoo.fr>, www-style@w3.org
Message-Id: <60130CD3-AAFC-4C09-88B8-A94A8106C201@gmail.com>
To: Anne van Kesteren <annevk@opera.com>

On Apr 7, 2010, at 9:02 AM, Anne van Kesteren wrote:

> On Wed, 07 Apr 2010 17:50:45 +0200, François REMY <fremycompany_pub@yahoo.fr> wrote:
>> To be logical, we should modify margin-top to calc(15%+1px).
>> Or is that no more allowed by CSS-Values?
> 
> For some definition of logical that is certainly an interesting idea. It would however completely break the getter/setter symmetry of "px". I personally value that a little higher.

Could you explain this further? Wouldn't you also get the px value of something that had a percentage style, as though you were using calc()?

Or, put differently, when setting the margin-top in this example, I would hope for this to  convert the percentage to px, add one px, then convert back to percentage (so that you are increasing the margin by one pixel based on the current width of the containing block, but not changing the continuing relationship between the margin and the containing block). If you actually wanted to go further and change the margin-top to a calc value, you would instead do something like this:

style.margin.m.top.calc.px++

Then, if the margin-top in the example would become "calc(15%+1px)", and in a different example where margin-top already had a calc value, then it would become "calc((<previous-formula>)+1px)". If you wanted to convert a value to calc when getting it (for whatever strange reason), you could do that like this:

style.margin.m.top.calc // --> "calc(15%)" in the first example




Received on Thursday, 22 April 2010 15:57:01 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:26 GMT