# Re: Question concering positioning in Microsoft B2 suite: left-091.htm

From: Bert Bos <bert@w3.org>
Date: Wed, 7 Jan 2009 16:50:01 +0100
To: "Robert Stam" <robert@tallcomponents.com>

Message-Id: <200901071650.01923.bert@w3.org>
```
On Friday 19 December 2008 19:52, Robert Stam wrote:

> The test 'left-091.htm' (see below) contains two nested div's both
> with a left-border. According to the test, the child's (black) border
> should be positioned exactly on top of the parent's (red) border.
> According to our calculation, the position of the child's border is
> actually to the left of the parent's border.
>
> The calculation of the position is done as follows:
>
> 1.       div1  starts at x=0 (assuming html, body and div have no
> margin, border , or padding in the default style sheet)
>
> 2.       div1 has no margin, so the left-border is position at x=0
> and ends at x=1.5pt (2px = 1.5pt)
>
> 3.       div2 has div1 as its containing block, starting at x=1.5
>
> 4.       div2 has a margin of -1.02in (which equals -1.02*72=-73.44
> pt)
>
> 5.       div2 has a relative left offset of 7.35ex (which equals 7.35
> * 0.8 (ex-height of Ahem) * 12pt (font-size) = 70.56pt)
>
> 6.       thus, the left position of div2 is 1.5 - 73.44 + 70.56 =
> -1.38pt
>
>
>
> Since the width of div2's left-border is also 1.5pt, we get a black
> line from x=-1.38 to x=0.12 and a red line from x=0 to x =1.5.
> This is not correct according to the description.
>
> Is there something wrong with our calculation?

I believe this calculation is correct (under the assumption that 1px is
close to 1/96 inch).

For the red border to be obscured, the black border must be at least
2.88pt wide, instead of the current 2px.

To avoid an error if the test is run on a device on which 2px > 2.88pt
(i.e., a device with 1px > 1/50 inch), it is best to express the border
of the #div1 in other units than px. I suggest to replace

2px
by
2.88pt

twice.

> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
> "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
>         <title>CSS Test Suite: Left using 'ex' units with a nominal
> value, 7.35ex</title>
>         <link rel="author" title="Microsoft"
> href="http://www.microsoft.com/" />
> href="http://www.w3.org/TR/CSS21/visuren.html#propdef-left" />
>         <meta name="flags" content="ahem" />
>         <meta name="assert" content="The 'left' property sets a
> nominal &lt;length&gt; value in 'ex' units." />
>         <style type="text/css">
>             div
>             {
>                 font: 12pt ahem;
>                 height: 1in;
>                 position: relative;
>             }
>             #div1
>             {
>                 border-left: 2px solid red;
>             }
>             #div2
>             {
>                 border-left: 2px solid black;
>                 margin-left: -1.02in;
>                 left: 7.35ex;
>             }
>         </style>
>     <body>
>         <p>Test passes if there is no red visible on the page.</p>
>         <div id="div1">
>             <div id="div2"></div>
>         </div>
>     </body>
> </html>

Bert
--
Bert Bos                                ( W 3 C ) http://www.w3.org/
http://www.w3.org/people/bos                               W3C/ERCIM
bert@w3.org                             2004 Rt des Lucioles / BP 93
+33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
```
Received on Wednesday, 7 January 2009 15:50:41 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:13:18 UTC