-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
223 lines (202 loc) Β· 7.23 KB
/
index.html
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>new.grid.css</title>
<meta name="theme-color" content="#F6F8FA">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="./new.min.css" type="text/css" rel="stylesheet">
<style>
/* responsiveness */
@media all and (min-width: 800px) {
/* add space so that the last item is not at the bottom of the screen */
main {
margin-bottom: 30rem;
}
}
footer {
margin-top: 1rem;
padding-top: 1rem;
border-top: 1px solid #E5E7EB;
}
</style>
<link href="./new.grid.css" type="text/css" rel="stylesheet">
</head>
<body>
<header>
<h1>new.grid.css π§βπ¨</h1>
<nav>
<a href="https://newcss.net/">π¨ new.css</a>
–
<a href="https://github.com/alexislefebvre/new.grid.css">π§βπ» source</a>
</nav>
</header>
<main>
<div>
<h2 id="table-of-content">Table of content</h2>
<ul>
<li><a href="#what">What is this page?</a></li>
<li><a href="#css-source">CSS source</a></li>
<li><a href="#one-one">2 columns with same width</a></li>
<li><a href="#one-two">2 columns, 1/3 and 2/3</a></li>
<li><a href="#one-one-one-one">4 columns with same width</a></li>
</ul>
</div>
<div id="what">
<h3>What is this page? <a href="#table-of-content">β</a></h3>
<p>
This page shows examples of code to use a minimalist grid,
associated to <a href="https://newcss.net/">new.css</a>
but it can work without any external CSS.
The display is responsive, items will be stacked vertically if the viewport is smaller than 801 pixels.
</p>
</div>
<div id="css-source">
<h3>CSS source <a href="#table-of-content">β</a></h3>
<details>
<summary>View the code π</summary>
<pre>.flex {
display: flex;
justify-content: space-between;
align-items: stretch;
gap: 0.5rem 2rem;
}
.flex.one-one > div {
flex-grow: 1;
min-width: 48%;
}
.flex.one-two > div:first-child {
min-width: 30%;
flex-grow: 1;
}
.flex.one-two > div:last-child {
min-width: 65%;
flex-grow: 2;
}
.flex.one-one-one-one > div {
min-width: 20%;
flex-grow: 1;
}
/* responsiveness */
@media all and (max-width: 800px) {
/* container */
.flex {
flex-direction: column;
}
.flex.one-one-one-one {
flex-direction: row;
flex-wrap: wrap;
}
.flex.one-one-one-one > div {
width: 40%;
}
.flex.one-one-one-one > div img {
min-width: 180px;
}
}
</pre>
</details>
<p><a href="./new.grid.css">See the CSS file</a></p>
</div>
<div id="one-one">
<h3>2 columns with same width <a href="#table-of-content">β</a></h3>
<div class="flex one-one">
<div>
<h4>Lorem Ipsum</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas iaculis pulvinar arcu at pulvinar. Pellentesque sed malesuada neque, at sollicitudin ante. Nunc in quam et magna consectetur lacinia. In luctus nibh dui, sit amet egestas lacus maximus quis. Maecenas et mattis libero. </p>
</div>
<div>
<h4>Sed volutpat</h4>
<p>Sed volutpat euismod nulla, sed molestie ex pretium a. Morbi semper, libero et feugiat fermentum, tortor augue feugiat nisi, ut fermentum risus augue eu augue.</p>
</div>
</div>
<details>
<summary>View the code π</summary>
<pre><div class="flex one-one">
<div>
<h4>Lorem Ipsum</h4>
<p>Lorem ipsum dolor sit amet, β¦</p
</div>
<div>
<h4>Sed volutpat</h4>
<p>Sed volutpat euismod nulla, β¦</p>
</div>
</div></pre>
</details>
</div>
<div id="one-two">
<h3>2 columns, 1/3 and 2/3 <a href="#table-of-content">β</a></h3>
<div class="flex one-two">
<div>
<h3>Lorem Ipsum</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas iaculis pulvinar arcu at pulvinar. Pellentesque sed malesuada neque, at sollicitudin ante. Nunc in quam et magna consectetur lacinia. In luctus nibh dui, sit amet egestas lacus maximus quis. Maecenas et mattis libero.</p>
</div>
<div>
<h2>Sed volutpat</h2>
<p>Sed volutpat euismod nulla, sed molestie ex pretium a. Morbi semper, libero et feugiat fermentum, tortor augue feugiat nisi, ut fermentum risus augue eu augue.</p>
</div>
</div>
<details>
<summary>View the code π</summary>
<pre><div class="flex one-two">
<div>
<h4>Lorem Ipsum</h4>
<p>Lorem ipsum dolor sit amet, β¦</p
</div>
<div>
<h4>Sed volutpat</h4>
<p>Sed volutpat euismod nulla, β¦</p>
</div>
</div></pre>
</details>
</div>
<div id="one-one-one-one">
<h3>4 columns with same width <a href="#table-of-content">β</a></h3>
<div class="flex one-one-one-one">
<div>
<h4>πΆ 1</h4>
<p><img src=" https://placedog.net/180/135?id=1" width="180" height="135" alt="πΆ 1"></p>
</div>
<div>
<h4>πΆ 2</h4>
<p><img src=" https://placedog.net/180/135?id=2" width="180" height="135" alt="πΆ 2"></p>
</div>
<div>
<h4>πΆ 3</h4>
<p><img src=" https://placedog.net/180/135?id=3" width="180" height="135" alt="πΆ 3"></p>
</div>
<div>
<h4>πΆ 4</h4>
<p><img src=" https://placedog.net/180/135?id=4" width="180" height="135" alt="πΆ 4"></p>
</div>
</div>
<details>
<summary>View the code π</summary>
<pre><div class="flex one-one-one-one">
<div>
<h4>πΆ 1</h4>
<p><img src=" https://placedog.net/180/135?id=1" width="180" height="135" alt="πΆ 1"></p>
</div>
<div>
<h4>πΆ 2</h4>
<p><img src=" https://placedog.net/180/135?id=2" width="180" height="135" alt="πΆ 2"></p>
</div>
<div>
<h4>πΆ 3</h4>
<p><img src=" https://placedog.net/180/135?id=3" width="180" height="135" alt="πΆ 3"></p>
</div>
<div>
<h4>πΆ 4</h4>
<p><img src=" https://placedog.net/180/135?id=4" width="180" height="135" alt="πΆ 4"></p>
</div>
</div></pre>
</details>
</div>
</main>
<footer>
<a href="https://validator.w3.org/check?uri=https%3A%2F%2Falexislefebvre.github.io%2Fnew.grid.css%2F">Valid HTML5</a>
–
<a href="https://alexislefebvre.com">https://alexislefebvre.com</a>
</footer>
</body>
</html>