box-offsets-rel-pos-002

box offsets - position relative

WeasyPrint

This browser

Flags
image
Assertion
The 'top', 'right', 'bottom', 'left' property, for relative positioning, specify the offset of the box itself from its normal in-flow position, from the position it would have had if it had been static.

Source

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 2 <html>
 3 
 4  <head>
 5 
 6   <title>CSS Test: box offsets - position relative</title>
 7 
 8   <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
 9   <link rel="help" title="9.3.2 Box offsets: 'top', 'right', 'bottom', 'left'" href="http://www.w3.org/TR/CSS21/visuren.html#position-props">
10   <meta content="image" name="flags">
11   <meta content="The 'top', 'right', 'bottom', 'left' property, for relative positioning, specify the offset of the box itself from its normal in-flow position, from the position it would have had if it had been static." name="assert">
12 
13   <style type="text/css">
14   img
15   {
16   position: relative;
17   vertical-align: bottom;
18   /* so that images do not "sit" on the 
19   baseline but at bottom of line box */
20   }  
21   
22   img.moves-toward-left {right: 100px;}
23 
24   img.moves-toward-top {bottom: 100px;}
25 
26   img.moves-toward-right {left: 100px;}
27 
28   img.moves-toward-bottom {top: 100px;}
29 
30   /*
31   In this testcase, 7 red 100px wide by 100px squares overlap 
32   another red 100px wide by 100px square (placed in the center of a 3 
33   by 3 grid of squares) and then, at the end, one single bright 
34   green 100px wide by 100px square overlaps all 8 other red boxes.
35   */
36   </style>
37 
38  </head>
39 
40  <body>
41 
42   <p>Test passes if there is a filled bright green square and <strong>no red</strong></p>
43 
44   <div><img class="moves-toward-right moves-toward-bottom" src="support/red_box.png" width="100" height="100" alt="Image download support must be enabled"><img class="moves-toward-bottom" src="support/red_box.png" width="100" height="100" alt="Image download support must be enabled"><img class="moves-toward-left moves-toward-bottom" src="support/red_box.png" width="100" height="100" alt="Image download support must be enabled"></div>
45 
46   <div><img class="moves-toward-right" src="support/red_box.png" width="100" height="100" alt="Image download support must be enabled"><img src="support/red_box.png" width="100" height="100" alt="Image download support must be enabled"><img class="moves-toward-left" src="support/red_box.png" width="100" height="100" alt="Image download support must be enabled"></div>
47 
48   <div><img class="moves-toward-right moves-toward-top" src="support/red_box.png" width="100" height="100" alt="Image download support must be enabled"><img class="moves-toward-top" src="support/red_box.png" width="100" height="100" alt="Image download support must be enabled"><img class="moves-toward-left moves-toward-top" src="support/lime_color.png" width="100" height="100" alt="Image download support must be enabled"></div>
49 
50  </body>
51 </html>