W3C home > Mailing lists > Public > www-style@w3.org > March 2005

Re: %% units, was Designs that zoom (was : Why reduce font size)

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Mon, 7 Mar 2005 09:04:23 -0800
Message-ID: <004a01c52337$b60c73d0$0c01a8c0@TERRA>
To: "Ben Curtis" <bcurtis@bivia.com>, <www-style@w3.org>

| Say I have 4 floating divs, all width:25%. The viewport is 800px wide, 
| so each is 200px and they fit side by side. I shrink the viewport to 
| 798px, and each div is now:

<style>
#row > div 
{
       display:inline-block;
       width:25%%; //sic!
}
</style>

<div id=row>
   <div>1</div>
   <div>2</div>
   <div>3</div>
   <div>4</div>
<div>

Easy as %% behave like weights.

For me use of floats for doing in-line positioning 
is worse than using tables for that.


From: "Ben Curtis" <bcurtis@bivia.com>
Subject: Re: Designs that zoom (was : Why reduce font size)
| 
| >  This truly is a user agent problem and not a CSS problem, and may 
| > disappear as UAs become more precise.
| 
| This is a misunderstanding of the problem. It is not a math error, but 
| rather the accuracy of math that is the problem.
| 
| Say I have 4 floating divs, all width:25%. The viewport is 800px wide, 
| so each is 200px and they fit side by side. I shrink the viewport to 
| 798px, and each div is now:
| 
| round(798 * 0.25) = round(199.5) = 200px
| 
| ....totalling 800px, or 2px more than my viewport, causing the last div 
| to drop below the others. I shrink it to 797px, and each div is now:
| 
| round(797 * 0.25) = round(199.25) = 199px
| 
| ....totalling 796px, or 1px short of my viewport, even though they total 
| 100% of the width.
| 
| No matter how precise the UA is, this will be true. The only solution 
| is the elimination of pixels (either by pixels so fine the human eye 
| cannot discern them or fudging through anti-aliasing vector-based 
| drawing).
| 
| 
| > Perhaps CSS 2.1 or 3 should include a recommendation on how to handle 
| > pixel rounding?
| 
| This would be my suggestion. If all rounding was rounded down, and then 
| some algorithm was created to distribute whole pixels in some 
| deterministic way*, then it is likely we would have to try very hard to 
| see the problem. Even then, compliant browsers would at least be 
| consistent.
| 
| 
| * obviously, I leave the trickiest part to others smarter than I.
| 
| -- 
| 
| Ben Curtis : webwright
| bivia : a personal web studio
| http://www.bivia.com
| v: (818) 507-6613
| 
| 
| 
| 
|
Received on Monday, 7 March 2005 17:05:02 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:36 GMT