W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2008

[whatwg] Using Math In CSS3

From: Simon Pieters <simonp@opera.com>
Date: Tue, 05 Feb 2008 13:17:58 +0100
Message-ID: <op.t51wf8ioidj3kv@hp-a0a83fcd39d2.oslo.opera.com>
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'.

    http://www.w3.org/TR/css3-values/#calc
    http://www.w3.org/TR/css3-ui/#box-sizing


Cheers,
-- 
Simon Pieters
Opera Software
Received on Tuesday, 5 February 2008 04:17:58 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:39 UTC