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