Re: Arithmetic in <length> values

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 UTC