[whatwg] Using Math In CSS3

Simon Pieters simonp at opera.com
Tue Feb 5 04:17:58 PST 2008

On Tue, 05 Feb 2008 11:28:14 +0100, James Jeffery  
<cascadingstylez at googlemail.com> wrote:

> 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.

Two things...

1) This is the wrong list.

2) See calc() or 'box-sizing'.


Simon Pieters
Opera Software

More information about the whatwg mailing list