Skip to content

Commit 3741177

Browse files
committed
Add option to specify grid-auto-flow property in auto-placement demo
1 parent bd67cba commit 3741177

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

autoplacement.html

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@
5151
#new {
5252
padding-left: 25px;
5353
}
54+
55+
.grid div {
56+
width: 100%;
57+
height: 100%;
58+
}
5459
</style>
5560
<script>
5661
function randomColor() {
@@ -92,14 +97,30 @@
9297

9398
addGridItem();
9499
}
100+
101+
function updateGridAutoFlow() {
102+
var grid = document.getElementById("grid");
103+
var flow = document.getElementById("flow");
104+
105+
grid.style.webkitGridAutoFlow = flow.value;
106+
grid.style.gridAutoFlow = flow.value;
107+
}
95108
</script>
96109
</head>
97110
<body>
98111
<div id="grid" class="grid">
99112
</div>
100113
<div style="clear: both;"></div>
101114
<div id="new">
102-
<h2>CSS Grid Layout Auto-placement Algorithm</h2>
115+
<h2>CSS Grid Layout: <a href="http://dev.w3.org/csswg/css-grid/#auto-placement-algo">Grid Item Placement Algorithm</a></h2>
116+
<p>Property <a href="http://dev.w3.org/csswg/css-grid/#grid-auto-flow-property"><code>grid-auto-flow</code></a> is
117+
<select id="flow" onchange="updateGridAutoFlow();">
118+
<option value="row" selected>row</option>
119+
<option value="column">column</option>
120+
<option value="row dense">row dense</option>
121+
<option value="column dense">column dense</option>
122+
</select>
123+
</p>
103124
<p>New grid item at
104125
row
105126
<select id="row">
@@ -130,7 +151,6 @@ <h2>CSS Grid Layout Auto-placement Algorithm</h2>
130151
</p>
131152
<button onClick="addGridItem();">Add</button>
132153
<button onClick="addRandomGridItem();">Add random</button>
133-
<p><a href="http://www.w3.org/TR/css-grid-1/#auto-placement">Spec</a></p>
134154
</div>
135155
<table id="table">
136156
<tr>

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,9 @@ <h4 class="list-group-item-heading">Auto-placement Algorithm</h4>
235235
<a href="autoplacement.html" class="label label-primary">example</a>
236236
<a href="https://github.com/Igalia/css-grid-layout/blob/gh-pages/autoplacement.html" class="label label-success">html</a>
237237
<a href="https://github.com/Igalia/css-grid-layout/blob/gh-pages/autoplacement.png" class="label label-info">screenshot</a>
238-
<a href="http://www.w3.org/TR/css-grid-1/#auto-placement" class="label label-warning">spec</a>
238+
<a href="http://dev.w3.org/csswg/css-grid/#auto-placement-algo" class="label label-warning">spec</a>
239239
</p>
240-
<p>Auto-placement algorithm demo. Allow to new add grid items in different positions in order to check how the algorithm works.</p>
240+
<p>Auto-placement algorithm demo. Allow to new add grid items in different positions in order to check how the algorithm works. Also, includes the possibitly to change between the different <code>grid-auto-flow</code> property values.</p>
241241
</li>
242242
</ul>
243243
</div>

0 commit comments

Comments
 (0)