box-offsets-rel-pos-002.xht (2859B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2 3 <html xmlns="http://www.w3.org/1999/xhtml"> 4 5 <head> 6 7 <title>CSS Test: box offsets - position relative</title> 8 9 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> 10 <link rel="help" title="9.3.2 Box offsets: 'top', 'right', 'bottom', 'left'" href="http://www.w3.org/TR/CSS21/visuren.html#position-props" /> 11 <link rel="match" href="box-offsets-rel-pos-002-ref.xht" /> 12 13 <meta content="image" name="flags" /> 14 <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" /> 15 16 <style type="text/css"><![CDATA[ 17 img 18 { 19 position: relative; 20 vertical-align: bottom; 21 /* so that images do not "sit" on the 22 baseline but at bottom of line box */ 23 } 24 25 img.moves-toward-left {right: 100px;} 26 27 img.moves-toward-top {bottom: 100px;} 28 29 img.moves-toward-right {left: 100px;} 30 31 img.moves-toward-bottom {top: 100px;} 32 33 /* 34 In this testcase, 7 red 100px wide by 100px squares overlap 35 another red 100px wide by 100px square (placed in the center of 36 a 3 by 3 grid of squares) and then, at the end, one single 37 green 100px wide by 100px square overlaps all 8 other red boxes. 38 */ 39 ]]></style> 40 41 </head> 42 43 <body> 44 45 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 46 47 <div><img class="moves-toward-right moves-toward-bottom" src="support/100x100-red.png" width="100" height="100" alt="Image download support must be enabled" /><img class="moves-toward-bottom" src="support/100x100-red.png" width="100" height="100" alt="Image download support must be enabled" /><img class="moves-toward-left moves-toward-bottom" src="support/100x100-red.png" width="100" height="100" alt="Image download support must be enabled" /></div> 48 49 <div><img class="moves-toward-right" src="support/100x100-red.png" width="100" height="100" alt="Image download support must be enabled" /><img src="support/100x100-red.png" width="100" height="100" alt="Image download support must be enabled" /><img class="moves-toward-left" src="support/100x100-red.png" width="100" height="100" alt="Image download support must be enabled" /></div> 50 51 <div><img class="moves-toward-right moves-toward-top" src="support/100x100-red.png" width="100" height="100" alt="Image download support must be enabled" /><img class="moves-toward-top" src="support/100x100-red.png" width="100" height="100" alt="Image download support must be enabled" /><img class="moves-toward-left moves-toward-top" src="support/green_box.png" width="100" height="100" alt="Image download support must be enabled" /></div> 52 53 </body> 54 </html>