background-intrinsic-004.xht (2111B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <title>CSS Test: Background Intrinsic Sizes: Intrinsic Ratio (Match Heights)</title> 5 <link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact"/> 6 <link rel="help" href="http://www.w3.org/TR/CSS21/colors.html#background-properties" /> 7 <link rel="help" href="http://www.w3.org/TR/css3-background/#the-background-size"/> 8 <link rel="match" href="background-intrinsic-ref.xht"/> 9 <meta name="flags" content="may svg" /> 10 <meta name="assert" content="A background image with only an intrinsic ratio 11 covers largest rectangle at that ratio that exceeds neither the height nor 12 width of the background positioning area." /> 13 <style type="text/css"> 14 /* Setup. Use 5:6 ratio because it's weird and unlikely to be hard-coded anywhere. */ 15 div { 16 position: relative; 17 } 18 .cover, .limit { 19 width: 120px; 20 height: 120px; 21 margin: 0.5em; 22 background: green; /* Used to match reference; remove for debugging. */ 23 } 24 .control { 25 position: absolute; 26 top: 10px; bottom: 10px; 27 left: 10px; right: 30px; 28 } 29 .cover .control { 30 background: red; 31 } 32 .limit .control { 33 background: green; 34 } 35 .test { 36 /* 80x100 bgpos area */ 37 height: 80px; 38 width: 60px; 39 padding: 10px; 40 border: 10px solid transparent; 41 } 42 43 /* Test */ 44 .cover .test { 45 background: no-repeat url(support/green-intrinsic-ratio-portrait.svg); 46 } 47 .limit .test { 48 background: no-repeat url(support/red-intrinsic-ratio-portrait.svg); 49 } 50 .cover .control { 51 width: 66px; 52 } 53 .limit .control { 54 width: 67px; 55 } 56 </style> 57 </head> 58 <body> 59 <p>There must be two green boxes below and no red.</p> 60 61 <div class="cover"> 62 <div class="control"></div> 63 <div class="test"></div> 64 </div> 65 66 <div class="limit"> 67 <div class="test"></div> 68 <div class="control"></div> 69 </div> 70 71 </body> 72 </html>