W3C home > Mailing lists > Public > www-style@w3.org > March 2003

Re: Arithmetic in <length> values

From: Etan Wexler <ewexler@stickdog.com>
Date: Fri, 07 Mar 2003 20:01:51 -0800
To: www-style@w3.org
Message-id: <BA8EAB2E.3CB%ewexler@stickdog.com>

I (Etan Wexler) wrote to <www-style@w3.org> on 4 March 2003, "Arithmetic in
<length> values" (<mid:BA89C9E0.FF%25ewexler@stickdog.com>):

  <arithmetic-length>
      = ( <basic-length>+ )

  <percent-length>
      = <percent> | <length> | ( [<percent> | <basic-length>]+ )

As in the grammar used for value definitions in property definition tables,
parentheses represent actual parentheses.

Off-list discussion mentioned the importance of examples, which my previous
message lacked. The following examples remedy that defect.

div {
    margin-left: (3px +10em +3px);
    width: (-3px -10em -3px +100% -2ex);
    padding: 1ex;
    border: 0;
    }

div {
    margin: 2em 0 1em (3px +10em +3px);
    }

body {
    color: #000;
    background: url("image.png") no-repeat (+50% -1em) (4px +20%);
    }

Having just written those examples and repeatedly, half-consciously inserted
spaces between operators and following terms, I wish to put my support
behind the other syntax that I devised:

  <arithmetic-length>
      = ( [<basic-length> <pom>]+ <basic-length> )

  <percent-length>
      = <percent> | <length>
        | ( [[<percent> | <basic-length>] <pom>]+
            [<percent> | <basic-length>] )

  <pom>
      = "+" | "-"

This will allow expressions like the following.

div {
    margin-left: (3px + 10em + 3px);
    width: (-3px - 10em - 3px + 100% - 2ex);
    padding: 1ex;
    border: 0;
    }
Received on Friday, 7 March 2003 23:02:03 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:20 GMT