wpt / css / css-viewport / zoom / container-queries.html

Status: PASS | Duration: 8ms | Subtests: 1/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi

/css/css-viewport/zoom/container-queries.html

<!doctype html>
<title>Container queries use CSS pixels (i.e. not multipled by effective zoom)</title>
<link rel="author" title="Chris Harelson" href="mailto:chrishtr@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-viewport/">
<link rel="match" href="reference/container-queries-ref.html">
<style>
  .container {
    container-type: inline-size;
    width: 100px;
    height: 100px;
  }
  .child {
    background-color: green;
    height: 50px;
    width: 50px;
    @container (width > 120px) {
      background-color: red;
    }
  }
</style>
<p>All boxes below should be green.</p>
<div class="container">
  <div class="child"></div>
</div>
<div class="container" style="zoom: 2">
  <div class="child"></div>
</div>
<div class="container" style="zoom: 2">
  <div class="nested" style="zoom: 2">
    <div class="child"></div>
  </div>
</div>
<div class="outer" style="zoom: 2">
  <div class="container">
    <div class="child"></div>
  </div>
</div>

/css/css-viewport/zoom/reference/container-queries-ref.html

<!doctype html>
<title>Reference for container-queries.html</title>
<link rel="author" title="Chris Harelson" href="mailto:chrishtr@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-viewport/">
<style>
  .container {
    container-type: inline-size;
    width: 100px;
    height: 100px;
  }
  .child {
    background-color: green;
    height: 50px;
    width: 50px;
}
</style>
<p>All boxes below should be green.</p>
<div class="container">
  <div class="child"></div>
</div>
<div class="container" style="zoom: 2">
  <div class="child"></div>
</div>
<div class="container" style="zoom: 2">
  <div class="nested" style="zoom: 2">
    <div class="child"></div>
  </div>
</div>
<div class="outer" style="zoom: 2">
  <div class="container">
    <div class="child"></div>
  </div>
</div>