Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-flexbox/flex-aspect-ratio-resize-001.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>Flex item with aspect-ratio updates height correctly on container resize</title>
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
<link rel="match" href="flex-aspect-ratio-resize-001-ref.html">
<style>
.container {
display: flex;
width: 500px;
}
.wrapper {
width: 100%;
aspect-ratio: 1 / 1;
background: green;
}
.image {
display: block;
width: 100%;
height: 100%;
}
</style>
<p>Test passes if there is a 200x200 green square with no red.</p>
<div id="container" class="container" style="background: red;">
<div class="wrapper">
<img src="../support/1x1-green.png" class="image">
</div>
</div>
<script>
document.body.offsetHeight;
document.getElementById("container").style.width = "200px";
</script>