block-in-inline-relpos-002.xht (2323B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 3 <html xmlns="http://www.w3.org/1999/xhtml"> 4 <head> 5 <title>CSS Test: Relative-positioning Inline Containing Blocks and Floats</title> 6 <link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact"/> 7 <link rel="reviewer" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> <!-- 2012-03-07 --> 8 <link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#anonymous-block-level"/> 9 <link rel="match" href="block-in-inline-relpos-001-ref.xht" /> 10 11 <meta name="flags" content="ahem"/> 12 <meta name="assert" content="When such an inline box is affected by relative positioning, the relative positioning also affects the block-level box contained in the inline box."/> 13 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> 14 <style type="text/css"><![CDATA[ 15 .container { 16 margin: 1em; 17 font: 20px/1 Ahem; 18 border: solid silver; 19 width: 4em; 20 color: aqua; 21 background: fuchsia; 22 } 23 .relpos { 24 position: relative; 25 display: inline; 26 color: yellow; 27 left: 2em; 28 } 29 .block, .controlC { 30 color: orange; 31 background: orange; 32 width: 2em; 33 border-left: 2em solid blue; 34 } 35 .block { 36 margin-left: -2em; 37 height: 10px; 38 } 39 40 .float { 41 width: 2em; 42 height: 10px; 43 } 44 .float.L { 45 float: left; 46 background: orange; 47 color: orange; 48 } 49 .float.R { 50 float: right; 51 background: blue; 52 color: blue; 53 /* Back position to fill the hole left by relpos'ing .float.L */ 54 position: relative; 55 right: 4em; 56 } 57 58 .controlB { 59 color: yellow; 60 } 61 .controlC { 62 margin-left: 0; 63 } 64 ]]></style> 65 </head> 66 <body> 67 <p>The patterns in the 2 silver boxes must be <strong>identical</strong>.</p> 68 <div class="container"> 69 A<div class="relpos">B 70 <div class="block"></div> 71 <div class="float L"></div> 72 <div class="float R"></div> 73 <div></div> 74 B</div>A 75 </div> 76 <div class="container"> 77 A <span class="controlB">B</span> 78 <div class="controlC">C</div> 79 A<span class="controlB">B</span> 80 </div> 81 82 </body> 83 </html>