Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-sizing/stretch-function-replaced-aspect-ratio-contribution-001.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>CSS stretch(): a replaced element's intrinsic size contribution through its aspect ratio</title>
<link rel="match" href="../reference/ref-filled-green-100px-square.xht" />
<meta name="assert" content="A stretch() minimum block size takes its margins off before it transfers through a replaced element's aspect ratio into its intrinsic size contribution.">
<style>
#reference-overlapped-red {
position: absolute;
background-color: red;
width: 100px;
height: 100px;
z-index: -1;
}
.container {
width: max-content;
background: green;
}
canvas {
display: block;
width: 50%;
min-height: stretch(150px);
margin-bottom: 50px;
}
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div id="reference-overlapped-red"></div>
<!-- The canvas contributes 100px through its 1:1 aspect ratio, and is 100px tall less nothing: its
50px margin is inside the 150px. -->
<div class="container">
<canvas width="10" height="10"></canvas>
</div>