forked from aekaplan/grid
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
399 lines (346 loc) · 14 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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
<!DOCTYPE html>
<html>
<head>
<!-- Basic Page Needs -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Grid</title>
<meta name="description" content="A simple responsive framework.">
<!-- Mobile Specific Metas -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSS -->
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.0/normalize.css" type="text/css" />
<link rel="stylesheet" href="grid.css" type="text/css" />
<!--[if lt IE 9]>
<script src="http://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js"></script>
<![endif]-->
<!-- Typekit -->
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,600' rel='stylesheet' type='text/css'>
</head>
<body>
<header>
<div class='container'>
<div class="intro">
<a href="http://www.adamkaplan.me/grid">
<h1>grid</h1>
</a>
<p>A simple guide to responsive design.<br>Made by <a href="http://www.adamkaplan.me/" target="_blank">Adam Kaplan</a>.</p>
</div>
<img src="images/intro.png" alt="Intro" class="animated fadeInUp">
</div>
</header>
<section>
<div class='container'>
<img src="images/rwd.png" alt="RWD" class="rwd">
<h1>Why bother with responsive?</h1>
<p>We want our websites to be useable on all devices by responding to
the user’s behavior, screen size and screen orientation.</p>
</div>
</section>
<section class="example fragmentation">
<div class="container"></div>
</section>
<section>
<div class='container'>
<h1>A Fragmented World</h1>
<p><a href='http://opensignal.com/reports/fragmentation-2013/' target="_blank">As of 2013</a>, there are thousands of different devices and screen sizes that browse the
internet, so it's impossible to design layouts to target them all. Instead, we must take a more fluid approach to
design.</p>
</div>
</section>
<section>
<div class='container'>
<div class="circle">1</div>
<h1>Add the Viewport Meta Tag</h1>
<p>Place in the <code><head></code> of your HTML. This enables use of media queries for cross-device layouts.
<hr>
<script src="https://gist.github.com/anonymous/9225627.js"></script>
<hr>
<p>And place this in your CSS for compatibility with IE10+</p>
<br>
<script src="https://gist.github.com/anonymous/9550313.js"></script>
</div>
</section>
<section class="example">
<div class="container">
<img src="images/box-model.png" alt="Box Model">
</div>
</section>
<section>
<div class="container">
<h1>CSS Box Model</h1>
<p>It's important to understand the basics, like how elements are generated and behave in the browser, before
diving into responsive web design. The CSS Box Model consists of four distinct parts.</p>
<hr>
<div class="row">
<div class="column one-fourth">
<img src="images/content.png" alt="content">
<h3 class="content">Content</h3>
<p>The content of the box, where text and images appear.</p>
</div>
<div class="column one-fourth">
<img src="images/padding.png" alt="padding">
<h3 class="padding">Padding</h3>
<p>Clears an area around the content.</p>
</div>
<div class="column one-fourth">
<img src="images/border.png" alt="border">
<h3 class="border">Border</h3>
<p>A border that goes around the padding.</p>
</div>
<div class="column one-fourth">
<img src="images/margin.png" alt="margin">
<h3 class="margin">Margin</h3>
<p>Clears an area around the border.</p>
</div>
</div>
</div>
</section>
<section>
<div class='container'>
<div class="circle">2</div>
<h1>Use box-sizing: border-box</h1>
<p>Place at the top of your <code>CSS</code> file. The <code>*</code> will target all elements on the page.</p>
<hr>
<script src="https://gist.github.com/anonymous/9225647.js"></script>
</div>
</section>
<section>
<div class="container">
<h1>Your Choice</h1>
<p><a href="http://en.wikipedia.org/wiki/Internet_Explorer_box_model_bug" target="_blank">What was once a bug</a>
is now widely used CSS property. It basically means you can choose whether or not to include borders and padding in
the width of your content.</p>
<hr>
<div class="row">
<div class="column half">
<img src="images/without-box-model.png" alt="Without Box Model">
<h3>Without box-sizing: border-box</h3>
<p>Margin, borders and padding are drawn outside the set width of your content.</p>
</div>
<div class="column half">
<img src="images/with-box-model.png" alt="With Box Model">
<h3>With box-sizing: border-box</h3>
<p>Borders and padding are drawn inside the set width of your content. The margin is drawn outside.</p>
</div>
</div>
</div>
</section>
<section>
<div class='container'>
<div class="circle">3</div>
<h1>Create a Container</h1>
<p>A container holds all elements and controls the page's maximum width. Using a container will make designing for
responsive easier!</p>
<hr>
<script src="https://gist.github.com/anonymous/9225660.js"></script>
<script src="https://gist.github.com/anonymous/9225665.js"></script>
</div>
</section>
<section class="example">
<div class="container">
<img src="images/container.png" alt="Container">
</div>
</section>
<section>
<div class='container'>
<div class="circle">4</div>
<h1>Create a Column</h1>
<p>A column is a class used for stacking content horizontally. The first margin is removed using the
<a href="http://www.adamkaplan.me/pseudo-classes/">pseudo-class</a> <code>first-child</code>.</p>
<hr>
<script src="https://gist.github.com/anonymous/9225669.js"></script>
<script src="https://gist.github.com/anonymous/9225672.js"></script>
</div>
</section>
<section class="example grid">
<div class="container">
<div class="column">
<span>.column</span>
</div>
</div>
</section>
<section>
<div class='container'>
<div class="circle">5</div>
<h1>Create Column Sizes</h1>
<p>Add size classes to columns to create a reuseable grid system.</p>
<hr>
<script src="https://gist.github.com/anonymous/9225679.js"></script>
<script src="https://gist.github.com/anonymous/9225683.js"></script>
</div>
</section>
<section class="example grid">
<div class="container">
<div class="row">
<div class="column full">
<span>.column .full</span>
</div>
</div>
<div class="row">
<div class="column two-thirds">
<span>.column .two-thirds</span>
</div>
<div class="column one-third">
<span>.column .one-third</span>
</div>
</div>
<div class="row">
<div class="column half">
<span>.column .half</span>
</div>
<div class="column half">
<span>.column .half</span>
</div>
</div>
<div class="row">
<div class="column one-third">
<span>.column .one-third</span>
</div>
<div class="column one-third">
<span>.column .one-third</span>
</div>
<div class="column one-third">
<span>.column .one-third</span>
</div>
</div>
<div class="row">
<div class="column one-fourth">
<span>.column .one-fourth</span>
</div>
<div class="column one-fourth">
<span>.column .one-fourth</span>
</div>
<div class="column one-fourth">
<span>.column .one-fourth</span>
</div>
<div class="column one-fourth">
<span>.column .one-fourth</span>
</div>
</div>
</div>
</section>
<section>
<div class='container'>
<div class="circle">6</div>
<h1>Create Rows</h1>
<p>Columns are wrapped in rows to prevent other elements from stacking next to them, otherwise known as clearing
issues. Rows are cleared with a <code>clearfix</code>.</p>
<hr>
<script src="https://gist.github.com/anonymous/9225691.js"></script>
<hr>
<script src="https://gist.github.com/anonymous/9225695.js"></script>
</div>
</section>
<section class="example grid row-example">
<div class="container">
<div class="row clearfix">
<div class="column half">
<span>.column .half</span>
</div>
<div class="column half">
<span>.column .half</span>
</div>
</div>
<div class="row clearfix">
<div class="column one-third">
<span>.column .one-third</span>
</div>
<div class="column one-third">
<span>.column .one-third</span>
</div>
<div class="column one-third">
<span>.column .one-third</span>
</div>
</div>
</div>
</section>
<section>
<div class='container'>
<div class="circle">7</div>
<h1>Add a Mobile Breakpoint</h1>
<p>If the browser's screen size is within a set range, a media query
will replace the CSS the browser uses. This is the bread and butter of
responsive web design.</p>
<hr>
<script src="https://gist.github.com/anonymous/9225701.js"></script>
</div>
</section>
<section class="example grid">
<div class="mobile-background">
<div class="container mobile">
<div class="row">
<div class="column half">
<span>.column .half</span>
</div>
<div class="column half">
<span>.column .half</span>
</div>
</div>
<div class="row">
<div class="column one-third">
<span>.column .one-third</span>
</div>
<div class="column one-third">
<span>.column .one-third</span>
</div>
<div class="column one-third">
<span>.column .one-third</span>
</div>
</div>
</div>
</div>
</section>
<section>
<div class='container'>
<div class="circle">8</div>
<h1>Make It Work With IE8</h1>
<p>Add the <a href="https://github.com/aFarkas/html5shiv" target="_blank">html5shiv</a>
and <a href="https://github.com/scottjehl/Respond" target="_blank">Respond.js</a>
polyfills in the <code><head></code> of your HTML
to enable html5 elements and responsive breakpoints in Internet Explorer 8.</p>
<hr>
<script src="https://gist.github.com/anonymous/9225714.js"></script>
</div>
</section>
<section>
<div class='container'>
<h1>Practice Makes Perfect</h1>
<p>By following these simple steps, you are on the path to responsive
web design mastery. Keep practicing and help make the web a better,
more useable place.</p>
<hr>
<p><a href="https://github.com/jordanlev/grid" target="_blank">View the code for this project</a>.</p>
</div>
</section>
<section class="resources">
<div class="container">
<div class="column half">
<h3>Further Reading</h3>
<hr class="small">
<ul>
<li><a href="http://alistapart.com/article/for-a-future-friendly-web" target="_blank">For a Future-Friendly Web</a></li>
<li><a href="http://www.abookapart.com/products/responsive-web-design" target="_blank">A Book Apart: Responsive Web Design</a></li>
<li><a href="http://dev.tutsplus.com/articles/quick-tip-dont-forget-the-viewport-meta-tag--webdesign-5972" target="_blank">Don't Forget the Viewport Meta Tag</a></li>
<li><a href="http://fuseinteractive.ca/blog/understanding-humble-clearfix" target="_blank">Understanding the Humble Clearfix</a></li>
<li><a href="http://blog.teamtreehouse.com/beginners-guide-to-responsive-web-design" target="_blank">Beginner’s Guide to Responsive Web Design</a></li>
</ul>
</div>
<div class="column half">
<h3>References</h3>
<hr class="small">
<ul>
<li><a href="http://opensignal.com/reports/fragmentation-2013/" target="_blank">Android Fragmentation Visualized</a></li>
<li><a href="http://en.wikipedia.org/wiki/Internet_Explorer_box_model_bug" target="_blank">Internet Explorer Box Model</a></li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/box_model" target="_blank">Box Model</a></li>
<li><a href="http://css-tricks.com/snippets/css/clear-fix/" target="_blank">Force Element To Self-Clear its Children</a></li>
<li><a href="https://developers.google.com/chrome-developer-tools/" target="_blank">Chrome Developer Tools</a></li>
<li><a href="http://daneden.github.io/animate.css/" target="_blank">Animate.css</a></li>
</ul>
</div>
</div>
</div>
</section>
</body>
</html>