[whatwg] Using Math In CSS3

James Jeffery cascadingstylez at googlemail.com
Tue Feb 5 02:28:14 PST 2008


Morning all.

Im not sure if this is already a recommendation, or its already been thought
about, but here goes.

Basically i was working on a task, a 2 column layout simple as anything,
heres the css:

body {width: 50em;}

div#mainNav {width: 10em;}

div#content {width: 40em;}

Now if i want to add a border, say 1pixel all around, i have to convert 1px
to an em unit and minus that from the width values (n-40em), then add 1px
border all around. It would take me a few seconds on the calculator, i know,
but would it not be easier to have something like?:

 body {width: 50em;}

div#mainNav {width: (10em - 1px);}

div#content {width: (40em - 1px);}

#mainNav, #content {border: red 1px solid;}

I mean im sure there would be great use for it on larger and different
tasks, the example i provided was very simple. Basically the algorithm would
automatically be able to convert between px, em, % etc.

Just an idea, and im looking forward to any comments.

Kind Regards.

James Jeffery
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20080205/7d30e9ca/attachment.htm>


More information about the whatwg mailing list