background-size-cover-002

background-size - cover keyword value

WeasyPrint

Reference (good) by WeasyPrint

Reference (good) by this browser

This browser

Flags
image
Assertion
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.

Source

 1 <!DOCTYPE html>
 2 <html><head>
 3     <meta charset="UTF-8">
 4 
 5     <title>CSS Backgrounds and Borders Test: background-size - cover 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-cover-002-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 '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." 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: cover;
30             border-right: transparent solid 50px;
31             bottom: 100px;
32             height: 50px;
33             padding: 25px;
34             position: relative;
35             width: 0px;
36 
37             /*
38             Background positioning area to cover in this
39             test is 50px wide by 100px tall.
40             So, the image should be scaled to 100px by 100px.
41             */
42         }
43     </style>
44   </head>
45   <body>
46     <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
47     <div id="ref-overlapped-red"></div>
48     <div id="test-overlapping-green"></div>
49   
50 
51 </body></html>