-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
356 lines (289 loc) · 10.3 KB
/
Copy pathindex.html
File metadata and controls
356 lines (289 loc) · 10.3 KB
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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css"/>
<title>It's Your Fault You Hate CSS</title>
</head>
<body>
<div class="Block">
<h1>CSS and why it is your fault you hate it</h1>
<p>by Gianfranco Berardi</p>
</div>
<div class="Block">
<h1>CSS: The tl;dr </h1>
<p> Tackle your next project with more confidence when you: </p>
<ul>
<li> <p>Understand the difference between block and inline elements</p> </li>
<li> <p>Understand the logic of HTML rendering flow</p> </li>
<li> <p>Understand the Box Model</p> </li>
</ul>
<p>"The greatest deception men suffer is from their own opinions." - Leonardo da Vinci</p>
</div>
<div class="Block">
<h1>About Me</h1>
<img src="gb-2.png"/>
<h2> Gianfranco Berardi (<a href="https://www.twitter.com/GBGames">@GBGames</a>)</h2>
<ul>
<li> <p>he | him | his </p></li>
<li> <p>(Not an actual Web Developer)</p></li>
<li> <p>Game developer <a href="https://www.gbgames.com/">(GBGames.com)</a> who loves minimizing dependencies</p> </li>
<li> <p>Loves getting hands dirty <span class="VimAd">This site created with Vim</span></p> </li>
<li> <p>Insatiably curious</p></li>
</ul>
</div>
<div class="Block">
<h1>About Me</h1>
<p> Curious how browsers work under the hood (what can I steal for my game dev?)</p>
<p> Curious how to get better at my day job (much more front-end work) </p>
<p> Curious why so many people hate CSS (it can't be that bad, can it?) </p>
</div>
<div class="Block">
<h1>It's a Poor Workman Who Blames His Tools </h1>
<img class="NotDistorted2" src="PeterGriffin-CSS.gif"/>
<h2>My Hypothesis</h2>
<p> CSS is super easy to get into </p>
<p> So people think they know it </p>
<p> But they don't </p>
<p> Then they get mad that the tool isn't working like they expect it to </p>
<p> Easy to edit != Easy to do </p>
</div>
<div class="Block">
<h1>What I Found </h1>
<p> CSS <em>is</em> super easy to get into </p>
<p> HTML/CSS layout and flow is also super logical </p>
<p> But you need the right mental model </p>
</div>
<div class="Block">
<h1>HTML: The Foundation</h1>
<p> HTML is semantic.</p>
<p> HTML is text annotated with meaning. For example: </p>
<h1> I used <h1> here to say this is a heading</h1>
<p> I used <em> <em>here</em> to emphasize the word "here"</p>
<p> I used <a href> <a href="https://www.gbgames.com/">here</a> to create a link to my website</p>
</div>
</div>
<div class="Block">
<h1>HTML: The Foundation</h1>
<p> HTML has two types of elements. (Well, not anymore, but it still useful to say so)</p>
<p> Block: structure your page into sections (could contain more block or inline elements)</p>
<div class="BlockExample">
<p>Example</p>
<p>Also in this example</p>
</div>
<p> Inline: </p>
<div class="BlockExample">
<p> An example with <span class="InlineExample">something inline</span> of this otherwise ordinary block.</p>
</div>
<h2> This distinction was news to me! </h2>
</div>
</div>
<div class="Block">
<h1>CSS: The Interior Decorator</h1>
<p> If HTML is marked-up content, then CSS is the presentation of that content.</p>
<p> CSS styles allow you to bring out the meaning of HTML. For example: </p>
<h1> I used <h1> here to say this is a heading</h1>
<p> is styled with: </p>
<p>h1 {
box-shadow: 10px 5px 5px 1px rgba(5, 5, 5, 5);
background-color: green;
display: flex;
justify-content: flex-end;
font-family: serif;
font-weight: bold;
font-size: 46px;
padding: 10px;
}
</p>
<p> It could just as easily have been styled with: </p>
<p> h1 {
font-family: sans-serif;
font-weight: lighter;
font-size: 12px;
color: red;
}</p>
<h1 class="h1_style_example">And it would look like this, which isn't very heading-ish, is it?</h1>
</div>
</div>
<div class="Block">
<h1>HTML: The Normal Flow</h1>
<p> HTML is a tree structure </p>
<ul>
<li><p>Parents</p></li>
<ul>
<li><p>Children</p></li>
<li><p>Siblings</p></li>
</ul>
</ul>
</div>
<div class="Block">
<h1>HTML: The Normal Flow</h1>
<p>This structure dictates order and layering, and how elements fit around each other in general.</p>
<p>Defaults in English: </p>
<ul>
<li><p class="DebugHoverable">top to bottom </p> </li>
<li><p class="DebugHoverable">left to right</p> </li>
<li><p class="DebugHoverable">100% width of parent</p> </li>
<li><p class="DebugHoverable"> height as tall as content of the containing box and hopefully you will see this span a few lines vertically because there is so much quality content that it just cannot be contained on one line ok yep that should do it...</p> </li>
</ul>
</div>
<div class="Block">
<h1>HTML: The Normal Flow</h1>
<p> And CSS lets us change that flow! </p>
<div class="ExampleFrame">
<p>We can fix this with CSS! -></p >
<div class="FlowExample">
<div class="FlowExample2"></div>
<div class="FlowExample2"></div>
<div class="FlowExample2"></div>
</div>
<p> See! -> </p>
<div class="FlowExample3">
<div class="FlowExample2"></div>
<div class="FlowExample2"></div>
<div class="FlowExample2"></div>
</div>
</div>
</div>
</div>
<div class="Block">
<h1>The Box Model</h1>
<p> It's fairly straightforward.</p>
<div class="BoxModelMargin Hoverable">
Margin
<div class="BoxModelBorder Hoverable">
Border
<div class="BoxModelPadding Hoverable">
Padding
<div class="BoxModelContent Hoverable">
Content
</div>
</div>
</div>
</div>
</div>
</div>
<div class="Block">
<h1>The Box Model</h1>
<p> The margin surrounds the box. It says "Don't let other boxes come too close to me" </p>
<p> Margins don't add up between boxes. They "collapse" instead. </p>
<p> I imagine not knowing about the collapse can result in a Peter-Griffin-wrestling-with-blinds situation. </p>
<div class="BoxModelMargin">
<p>Box with margin of 10px</p>
</div>
<div class="BoxModelMargin">
<p>Another box with the same margin.</p>
</div>
<div class="BoxModelMargin2">
<p>A third box with 20px margin.</p>
</div>
</div>
</div>
<div class="Block">
<h1>The Box Model</h1>
<p> The border can have its own width and style. </p>
<div class="BoxModelBorder2">
<p>A thin black border surrounding the box.</p>
</div>
<div class="BoxModelBorder5">
<p>A thin black border curved at the corners </p>
</div>
<div class="BoxModelBorder3">
<p>A big dashed border.</p>
</div>
<div class="BoxModelBorder4">
<p>A large, curved dotted border, but only on one side.</p>
</div>
</div>
</div>
<div class="Block">
<h1>The Box Model</h1>
<p> The padding is like margin, but on the inside, where it counts. </p>
<p> You can give the contents of your elements space to breathe...or not. </p>
<div class="BoxModelPadding">
<span class="VimAd">I'm 25px away from the border of my containing box</span>
<p> It's a bit cramped, but we can make it work. Keep in mind that this <p> element has its own margin and padding, too. </p>
</div>
<div class="BoxModelPadding2">
<span class="VimAd">I'm 100px away from the border of my containing box. I can take a hint</span>
<p> It's spacious here, but how are the schools in the area? </p>
</div>
</div>
</div>
<div class="Block">
<h1>Putting It All Together</h1>
<p> We have a good mental model for how web pages render now:</p>
<ul>
<li> <p> We know that HTML can be arranged in blocks with some inline markup as well. </p> </li>
<li> <p> We know about the flow of HTML. </p> </li>
<li> <p> We know how the boxes are supposed to work in relation to each other. </p> </li>
</ul>
<h2> But do I know enough to be dangerous? </h2>
</div>
</div>
<div class="Block">
<h1>Writing CSS</h1>
<p> I decided to write up something interesting. </p>
<p> I did learn that CSS has animations built in, and so I started drawing. </p>
<p> I like that I can do a lot within CSS without JavaScript. </p>
<p> <a href="bunnies.html">Let's pet some bunnies!</a> </p>
</div>
</div>
<div class="Block">
<h1>Helping a Friend</h1>
<p> A colleague reached out to me asking for help with a non-profit's website. </p>
<p> The staff photos looked distorted.
<p> Had he asked just a few weeks prior, I would not have known how to fix the images. </p>
<p> A quick check, and I changed:</p>
<p>.maincontent img{
height:100px;
width:100px;
}</p>
<img class="Distorted" src="gb-2.png"/>
<p>to</p>
<p>
.maincontent img{
width:100px;
}
</p>
<img class="NotDistorted" src="gb-2.png"/>
<h2> Nothing major, but BAM! I'm a web developer now, right? </h2>
</div>
</div>
<div class="Block">
<h1>Can I Do My Day Job Better?</h1>
<p> Yes, it turns out! </p>
<p>PRIOR: Bumbled through. </p>
<p>TODAY: Bumble through with educated guesses about the box I am poking at. </p>
<p>RESULT: Much faster turnaround on styling work. </p>
</div>
</div>
<div class="Block">
<h1>What's Next?</h1>
<img class="NotDistorted" src="CSS_IS_AWESOME.jpg"/>
<p> Learn more of the fundamentals: what's with float? See Mandy Michael's "CSS is Awesome" thread on Twitter: <a href="https://twitter.com/Mandy_Kerr/status/985351593972252672">https://twitter.com/Mandy_Kerr/status/985351593972252672</a> </p>
<p> Learn best practices. </p>
<p> Figure out how to use concepts from the Flow and the Box Model in my 2D game development. </p>
<p> Write a CSS-only game. See The Mine: <a href="https://codepen.io/jcoulterdesign/pen/NOMeEb">https://codepen.io/jcoulterdesign/pen/NOMeEb</a></p>
<p> Use CSS to draw better-looking bunnies. See Wenting Zhang's work and A Single Div: <a href="https://a.singlediv.com/">https://a.singlediv.com/</a>. </p>
<p> </p>
</div>
</div>
<div class="Block">
<h1>Resources</h1>
<ul>
<li> <p> <a href="https://marksheet.io">MarkSheet.io</a>, a free HTML & CSS tutorial </p> </li>
<li> <p> <a href="https://developer.mozilla.org/">MDN web docs</a>, resources for developers, by developers </p> </li>
<li> <p> <a href="https://css-tricks.com/">CSS-Tricks</a>, a neat resource for web development</p> </li>
</ul>
</div>
</div>
<div class="Block">
<h1>Questions?</h1>
<h2> Gianfranco Berardi </h2>
<li> <p> Website: <a href="https://www.gbgames.com/">GBGames.com</a> </p> </li>
<li> <p> Twitter: <a href="https://www.twitter.com/GBGames">@GBGames</a> </p> </li>
<li> <p> Google+: RIP </p> </li>
</div>
</div>
</body>
</html>