summaryrefslogtreecommitdiffstats
path: root/layout/docs/css-gap-decorations/examples/grid-lateral-001.html
blob: 05f80265f62b96a3603006a11823d597d0f341c2 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!doctype html>
<!--
     Any copyright is dedicated to the Public Domain.
     http://creativecommons.org/publicdomain/zero/1.0/
-->
<title>Examples of rule lateral properties</title>
<style>
html,body {
  color:black; background-color:white; font:20px/1 monospace;
}

.grid {
  position: relative;
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 4px 16px;

  column-rule: 8px solid blue;

  row-rule: 2px solid purple;
  row-rule-align: rule;
  row-rule-extent: end;
  row-rule-longitudinal-inset: 2px;

  border: 5px solid;
  margin-right: 15px;
  margin-bottom: 30px;
  background: lightgrey;
  padding: 10px;
}

x {
  inline-size: 50px;
  block-size: 1.5em;
  background: grey;
}

.test1 {
  column-rule-width: auto;
  column-rule-lateral-inset: 2px 6px;
}
.test2 {
  column-rule-width: auto;
  column-rule-lateral-inset: auto 3px;
}
.test3 {
  column-rule-width: auto;
  column-rule-lateral-inset: auto;
}
.test4 {
  column-rule-width: 2px;
  column-rule-lateral-inset: 3px auto;
}
.test5 {
  column-rule-width: 2px;
  column-rule-lateral-inset: 10px 100px;
}
.test6 {
  column-rule-width: auto;
  column-rule-lateral-inset: 12px 100px;
}
.test7 {
  column-rule-width: auto;
  column-rule-lateral-inset: auto 30px;
}

.grid::after {
  position: absolute;
  width: 200px;
  bottom: -2em;
  content: attr(test);
  font-size: 10px;
}
pre {
  font-size: 10px;
}
</style>

<pre>
The triplet of values below each grid container are:
column-rule-lateral-inset-start, column-rule-width, column-rule-lateral-inset-end
</pre>
<div class="grid test1"><x>1</x><x>2</x></div>
<div class="grid test2"><x>1</x><x>2</x></div>
<div class="grid test3"><x>1</x><x>2</x></div><br>
<div class="grid test4"><x>1</x><x>2</x></div>
<div class="grid test5"><x>1</x><x>2</x></div><br>
<div class="grid test6"><x>1</x><x>2</x><x>3</x><x>4</x></div>
<div class="grid test7"><x>1</x><x>2</x><x>3</x><x>4</x></div>


<script>
window.onload = function() {
  [...document.querySelectorAll('.grid')].forEach(function(elm) {
    const cs = window.getComputedStyle(elm);
    elm.setAttribute("test", 
      cs.columnRuleLateralInsetStart + ", " +
      cs.columnRuleWidth + ", " +
      cs.columnRuleLateralInsetEnd
    );
  });
}
</script>