summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-grid/alignment/grid-gutters-014.html
blob: 404e694ec8698a4efa3361eb6b3a5c20f8865b42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Grid Layout Test: Percentage gap, content-based width/height (via float)</title>
<link rel="help" href="https://www.w3.org/TR/css-grid-1/#gutters">
<link rel="help" href="https://www.w3.org/TR/css-align-3/#gaps">
<link rel="match" href="grid-gutters-014-ref.html">
<link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact">
<meta name="assert" content="Tests that percentage gaps contribute zero to intrinsic sizing, then resolve against corresponding axis of containing block for layout.">

<style>
    #grid {
        display: grid;
        border: solid 5px teal;
        padding: 5px;
        grid-gap: 15% 10%;
        gap: 15% 10%;
        float: left;
        grid: auto auto / auto auto;
        /* content box width = 200px height = 100px -> gap x = 20px y = 15px */
        position: relative;
    }

    #grid > div {
        margin: 5px 10px;
        border: solid 5px aqua;
        width: 70px;
        height: 30px;
        /* margin box height = 50px width = 100px */
    }

    /* highlight manual pass condition */
    #grid > div:nth-child(even) {
        border-right-color: red;
    }
    #grid > div:nth-child(n + 3) {
        border-bottom-color: red;
    }
    #mask {
        position: absolute;
        border: 5px teal;
        border-style: none solid solid none;
        bottom: -5px; right: -5px;
        top: 10px; left: 15px;
    }
</style>

<p>Test passes if there is no red.
<div id="grid">
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <span id="mask"></span>
</div>