background-size-cover

background-size:cover

WeasyPrint

Reference (good) by WeasyPrint

Reference (good) by this browser

This browser

Flags
image
Assertion
The background image is scaled, while preserving its intrinsic aspect ratio (if any), to the smallest size such that both its width and its height can completely cover the background positioning area.

Source

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 2 <html>
 3   <head>
 4     <title>CSS Test: background-size:cover</title>
 5     <link rel="author" title="Jeffrey Carl Faden" href="http://www.jeffreyatw.com/">
 6     <link rel="match" href="reference/background-size-cover.htm">
 7     <link rel="help" href="http://www.w3.org/TR/css3-background/#the-background-size">
 8     <meta name="flags" content="image">
 9     <meta name="assert" content="The background image is scaled, while preserving its intrinsic aspect ratio (if any), to the smallest size such that both its width and its height can completely cover the background positioning area.">
10     <style type="text/css">
11       
12       div {
13         background-color: red;
14         background-image: url("support/rectangle-96x60.png");
15         background-size: cover;
16         height: 200px;
17         width: 200px;
18       }
19       
20     </style>
21   </head>
22   <body>
23     <p><img src="support/rectangle-96x60.png" alt="Image download support must be enabled"></p>
24     <p>Test passes if a scaled portion of above image appears inside the below square.</p>
25     <p>Test fails if any red area is seen outside of the image.</p>
26     <div></div>
27   </body>
28 </html>