W3C home > Mailing lists > Public > www-style@w3.org > May 2004

CSS: %% length unit. Proposal.

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Thu, 6 May 2004 20:02:43 -0700
To: www-style@w3.org
Message-ID: <c7eu8j$euh$1@sea.gmane.org>

I propose CSS length unit: %% (double percent unit) which could be
applied to box dimensions and margins:

"The percentage is calculated with respect to the width of the generated
box's containing block *minus widths of all fixed elements in the line*".

If applied these units allow to position proportionally elements horizontaly
and verticaly without need to use tables.

Lets say we have three blocks placed inline with widths 25%%, 100px and

Actual first and third block widths will be calculated from
ContainerContentWidth-100px weighted by their percentable values.

Other example - how to place div content in the center of browser view
horizontally and verticaly:

<div style=margin:50%%>Hey! I am in the center</div>

Being applied to text inline blocks this will allow to insert "spring"
elements in text:

<P>Here is first input element <INPUT width=100px> and here is another:
<INPUT width=100%%></P>
If we will use new schema then last input element will occupy the rest of
the line.

one more example:

<P><img src=hline.png style="width:25%%" />Caption<img src=hline.png
style="width:75%%" /></P>

I've implemented this alghorithm in my experimental rendering engine.
Implementation is pretty simple and do not increase comlexity of existing
alghorithms significantly. This will allow to avoid using tables in most use

If anybody want to take a look just drop me message.

Andrew Fedoniouk.
MS, Physics and Applied Mathematics.
Terra Informatica Sofrware Design.
Richmond. British Columbia. Canada.
Received on Thursday, 6 May 2004 23:02:48 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:13 UTC