Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
            
- /css/css-position/position-absolute-margin-auto-001.html - WPT Dashboard Interop Dashboard
 
 
<!DOCTYPE html>
<title>Tests the calculation of negative auto margins of absolutely positioned element</title>
<link rel="author" href="mailto:xiaochengh@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>
<style>
.cb {
  position: relative;
  width: 400px;
  height: 400px;
  outline: 1px dashed black;
}
.target {
  writing-mode: vertical-lr;
  position: absolute;
  background: green;
  width: calc(100% - 100px);
  height: calc(100% - 100px);
  inset: 100px;
  margin: auto;
}
</style>
<body onload="checkLayout('.target')">
  <div class="cb">
    <div class="target"
         data-expected-margin-top="-50" data-expected-margin-bottom="-50"
         data-expected-margin-left="0" data-expected-margin-right="-100"></div>
  </div>
</body>