background-intrinsic-008.xht (1973B)
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 Height and Ratio</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 missing background image width is calculated 11 from the height and the ratio." /> 12 <style type="text/css"> 13 /* Setup. Use 5:6 ratio because it's weird and unlikely to be hard-coded anywhere. */ 14 div { 15 position: relative; 16 } 17 .cover, .limit { 18 width: 120px; 19 height: 120px; 20 margin: 0.5em; 21 background: green; /* Used to match reference; remove for debugging. */ 22 } 23 .control { 24 position: absolute; 25 top: 10px; bottom: 10px; 26 left: 10px; right: 30px; 27 } 28 .cover .control { 29 background: red; 30 } 31 .limit .control { 32 background: green; 33 } 34 .test { 35 /* 80x100 bgpos area */ 36 height: 80px; 37 width: 60px; 38 padding: 10px; 39 border: 10px solid transparent; 40 } 41 42 /* Test */ 43 .cover .test { 44 background: no-repeat url(support/green-intrinsic-height-ratio.svg); 45 } 46 .limit .test { 47 background: no-repeat url(support/red-intrinsic-height-ratio.svg); 48 } 49 .control { 50 width: 40px; 51 height: 60px; 52 } 53 </style> 54 </head> 55 <body> 56 <p>There must be two green boxes below and no red.</p> 57 58 <div class="cover"> 59 <div class="control"></div> 60 <div class="test"></div> 61 </div> 62 63 <div class="limit"> 64 <div class="test"></div> 65 <div class="control"></div> 66 </div> 67 68 </body> 69 </html>