background-size-cover-002.html (2045B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="UTF-8"> 5 6 <title>CSS Backgrounds and Borders Test: background-size - cover keyword value</title> 7 8 <link rel="author" title="Intel" href="http://www.intel.com"> 9 <link rel="reviewer" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> <!-- 2012-11-08 --> 10 <!-- 11 http://www.gtalbot.org/BrowserBugsSection/review/background-size-cover-002-review.html 12 --> 13 <link rel="help" href="http://www.w3.org/TR/css3-background/#the-background-size" title="3.9. Sizing Images: the 'background-size' property"> 14 <link rel="match" href="../reference/ref-filled-green-100px-square.xht"> 15 16 <meta name="flags" content="image"> 17 <meta name="assert" content="Check if 'background-size' is 'cover' that it scales the background-image, while preserving its intrinsic aspect ratio (it is 1:1 in this test), to the smallest size such that both its width and its height can completely cover the background positioning area. In this test, the background-image should be scaled to become 100px by 100px."> 18 <style> 19 div#ref-overlapped-red 20 { 21 background-color: red; 22 height: 100px; 23 width: 100px; 24 } 25 26 div#test-overlapping-green 27 { 28 background-image: url("support/50x50-green.png"); 29 background-repeat: no-repeat; 30 background-size: cover; 31 border-right: transparent solid 50px; 32 bottom: 100px; 33 height: 50px; 34 padding: 25px; 35 position: relative; 36 width: 0px; 37 38 /* 39 Background positioning area to cover in this 40 test is 50px wide by 100px tall. 41 So, the image should be scaled to 100px by 100px. 42 */ 43 } 44 </style> 45 </head> 46 <body> 47 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 48 <div id="ref-overlapped-red"></div> 49 <div id="test-overlapping-green"></div> 50 </body> 51 </html>