| <!DOCTYPE html> |
| <meta charset="utf-8"> |
| <title>CSS Grid Layout Test: Margin auto and replaced grid item</title> |
| <link rel="author" title="Hyunjune Kim" href="mailto:hyunjune.kim@samsung.com"> |
| <link rel="help" href="https://www.w3.org/TR/css-grid-1/#alignment"> |
| <meta name="assert" content="Checks width of the nested grid container applied 'margin:auto' with a replaced item which has a property called max-height."> |
| <link rel="match" href="grid-auto-margin-and-replaced-item-001-ref.html"> |
| <style> |
| #reference-overlapped-red { |
| position: absolute; |
| background-color: red; |
| width: 100px; |
| height: 100px; |
| left:0; |
| right:0; |
| margin: auto; |
| z-index: -1; |
| } |
| .grid { |
| display: grid; |
| } |
| .nested-grid { |
| display: grid; |
| margin: auto; |
| } |
| img { |
| max-height: 100%; |
| } |
| </style> |
| |
| <body onload="loadImage()"> |
| |
| <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> |
| |
| <div class="grid"> |
| <div id="reference-overlapped-red"></div> |
| <div class="nested-grid"> |
| <img id="replaced"> |
| </div> |
| </div> |
| |
| <script> |
| function loadImage() { |
| var replaced = document.getElementById("replaced"); |
| replaced.src = "./support/100x100-green.png"; |
| } |
| </script> |