W3C home > Mailing lists > Public > www-talk@w3.org > January to February 2008

Using Math In CSS3

From: James Jeffery <cascadingstylez@googlemail.com>
Date: Tue, 5 Feb 2008 10:36:24 +0000
Message-ID: <972994690802050236y79ee2f2bx7bad138477ef0530@mail.gmail.com>
To: www-talk@w3.org
Morning all.

Im not sure if this is already a recommendation, or its already been thought
about, if not i would like to do so.

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

body {width: 50em;}

div#mainNav {width: 10em;}

div#content {width: 40em;}

Now if i want to add a border, say 1px, i have to convert 1px to an em unit
and minus that from the width values (40em-n), 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; overflow: hidden;}

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

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

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

Im sure there would be great use for it on larger and different tasks, the
example i provided was very simple and probably not the best example.
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
Received on Wednesday, 6 February 2008 06:25:27 UTC

This archive was generated by hypermail 2.4.0 : Monday, 20 January 2020 16:08:30 UTC