mirror of
https://github.com/servo/servo
synced 2026-04-28 10:27:40 +02:00
64 lines
2.3 KiB
HTML
64 lines
2.3 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
<html>
|
|
|
|
<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.htm">
|
|
|
|
<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">
|
|
div#overlapped-red
|
|
{
|
|
background-image: url("support/200x200-red.png");
|
|
background-repeat: no-repeat;
|
|
background-size: contain;
|
|
height: 150px;
|
|
padding: 25px;
|
|
width: 50px;
|
|
/*
|
|
background positioning area is 100px wide by 200px 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-bottom: transparent solid 50px;
|
|
bottom: 200px;
|
|
height: 0px;
|
|
padding: 25px;
|
|
position: relative;
|
|
width: 50px;
|
|
|
|
/*
|
|
background positioning area to cover is 100px wide by
|
|
50px 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> |