blob: d168e154fb34fea05c6c05a201b030099d5cdf01 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS Backgrounds and Borders Test: background-size - cover value and contain value</title>
<link rel="author" title="GĂ©rard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
<link rel="help" href="http://www.w3.org/TR/css3-background/#the-background-size" title="3.9. Sizing Images: the 'background-size' property" />
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht" />
<meta name="flags" content="image" />
<meta name="assert" content="When 'background-size' is 'cover', then the background-image is scaled, 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. When 'background-size' is 'contain', then the background-image is scaled, 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 2 background-images should be scaled to become 100px by 100px." />
<style type="text/css"><![CDATA[
div#overlapped-red
{
background-image: url("support/200x200-red.png");
background-repeat: no-repeat;
background-size: contain;
height: 50px;
padding: 25px;
width: 150px;
/*
background positioning area is 200px wide by 100px tall.
The largest size that can fit inside it with a 1:1 ratio
is 100px by 100px. So, the background image should be
scaled to 100px by 100px.
*/
}
div#overlapping-green
{
background-image: url("support/50x50-green.png");
background-repeat: no-repeat;
background-size: cover;
border-right: transparent solid 50px;
bottom: 100px;
height: 50px;
padding: 25px;
position: relative;
width: 0px;
/*
background positioning area to cover is 50px wide by
100px tall. The smallest size that can completely cover
it with a 1:1 ratio is 100px by 100px. So, the
background image should be scaled to 100px by 100px.
*/
}
]]></style>
</head>
<body>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div id="overlapped-red"></div>
<div id="overlapping-green"></div>
</body>
</html>