background-intrinsic-006.xht (2087B)
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 Percentage Width and Height</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="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-width-pc-height-pc.svg); 46 } 47 .limit .test { 48 background: no-repeat url(support/red-intrinsic-width-pc-height-pc.svg); 49 } 50 .control { 51 width: 32px; 52 height: 60px; 53 } 54 </style> 55 </head> 56 <body> 57 <p>There must be two green boxes below and no red.</p> 58 59 <div class="cover"> 60 <div class="control"></div> 61 <div class="test"></div> 62 </div> 63 64 <div class="limit"> 65 <div class="test"></div> 66 <div class="control"></div> 67 </div> 68 69 </body> 70 </html>