wpt / css / css-grid / alignment / grid-gutters-explicit-placement.html

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

/css/css-grid/alignment/grid-gutters-explicit-placement.html

<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Grid Layout Test: explicitly-placed grid items honor gutters in position and size</title>
<link rel="help" href="https://www.w3.org/TR/css-grid-1/#gutters">
<link rel="match" href="grid-gutters-explicit-placement-ref.html">
<link rel="author" title="Yulun Wu" href="mailto:yulun_wu@apple.com">
<meta name="assert" content="Grid items placed with explicit grid-row and grid-column lines are offset and sized to account for the row-gap and column-gap between the lines they span.">
<style>
    #grid {
        display: grid;
        width: 310px;
        gap: 20px;
        grid-template-columns: 90px 90px 90px;
        grid-template-rows: 90px 90px 90px;
        background-color: green;
    }

    #grid > div {
        background-color: blue;
    }
</style>

<p>The test passes if it has the same visual effect as reference.</p>
<div id="grid">
    <div style="grid-row: 1 / 2; grid-column: 1 / 2;"></div>
    <div style="grid-row: 1 / 2; grid-column: 2 / 3;"></div>
    <div style="grid-row: 1 / 2; grid-column: 3 / 4;"></div>
    <div style="grid-row: 2 / 3; grid-column: 1 / 2;"></div>
    <div style="grid-row: 2 / 3; grid-column: 2 / 3;"></div>
    <div style="grid-row: 2 / 3; grid-column: 3 / 4;"></div>
    <div style="grid-row: 3 / 4; grid-column: 1 / 2;"></div>
    <div style="grid-row: 3 / 4; grid-column: 2 / 3;"></div>
    <div style="grid-row: 3 / 4; grid-column: 3 / 4;"></div>
</div>

/css/css-grid/alignment/grid-gutters-explicit-placement-ref.html

<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Grid Layout Reference: a 3x3 grid of blue squares on a green background</title>
<link rel="author" title="Yulun Wu" href="mailto:yulun_wu@apple.com">
<style>
    #grid {
        width: 310px;
        height: 310px;
        background-color: green;
        position: relative;
    }

    #grid > div {
        background-color: blue;
        width: 90px;
        height: 90px;
        position: absolute;
    }

    #grid :nth-child(1) { top: 0; left: 0; }
    #grid :nth-child(2) { top: 0; left: 110px; }
    #grid :nth-child(3) { top: 0; left: 220px; }
    #grid :nth-child(4) { top: 110px; left: 0; }
    #grid :nth-child(5) { top: 110px; left: 110px; }
    #grid :nth-child(6) { top: 110px; left: 220px; }
    #grid :nth-child(7) { top: 220px; left: 0; }
    #grid :nth-child(8) { top: 220px; left: 110px; }
    #grid :nth-child(9) { top: 220px; left: 220px; }
</style>

<p>The test passes if it has the same visual effect as reference.</p>
<div id="grid">
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
</div>