-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
623 lines (621 loc) · 24.4 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
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
<!DOCTYPE html>
<html>
<head>
<title>CSS Attributes Cheat Sheet</title>
<link href='styles.css' rel='stylesheet'>
</head>
<body>
<h1>CSS Cheat Sheet</h1>
<h3>CSS Selectors</h3>
<div class="table1">
<table>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">HTML Tag</th>
<th scope="col">CSS Example</th>
<th scope="col">Description / Key Aspects</th>
</tr>
</thead>
<tbody>
<tr>
<td class="col1">Type</td>
<td class="col2">h1, p, etc.</td>
<td class="col3">h1 { color: red }</td>
<td class="col4">Selectors that come from the html tag. aka tag name or element selector</td>
</tr>
<tr>
<td class="col1">Universal</td>
<td class="col2"></td>
<td class="col3">* { color: red }</td>
<td class="col4">Selects all elements of any type</td>
</tr>
<tr>
<td class="col1">Class</td>
<td class="col2">class='brand'</td>
<td class="col3">.brand { color: red }</td>
<td class="col4">Selects any object with that class designation</td>
</tr>
<tr>
<td class="col1">Multiple Classes</td>
<td class="col2">class='brand color'</td>
<td class="col3">.brand { } .color { }</td>
<td class="col4">Able to have two or more classes declared within one statement, must be seperated with a space</td>
</tr>
<tr>
<td class="col1">ID</td>
<td class="col2">id='title'</td>
<td class="col3">#title: { color: red }</td>
<td class="col4">Unlike classes that can be used broadly throughout, an id can only have a single value and be used once</td>
</tr>
<tr>
<td class="col1">Attribute</td>
<td class="col2">href</td>
<td class="col3">[href] { color: red }</td>
<td class="col4">[href] would target all elements with a href attribute</td>
</tr>
<tr>
<td class="col1">Granular Attribute</td>
<td class="col2">img[src=....winter]</td>
<td class="col3">img[src*='winter']</td>
<td class="col4">This would select an element with attribute of src that containts the string 'winter'</td>
</tr>
<tr>
<td class="col1">Pseudo Class</td>
<td class="col2">p:hover p:visited</td>
<td class="col3">p:hover { color: red} </td>
<td class="col4">pseudo classes always start with a : and can be attached to any selector</td>
</tr>
</tbody>
</table>
</div>
<h3>CSS Visual Rules</h3>
<div class="table2">
<table>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">CSS Example</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="col1">font-family</td>
<td class="col2">font-family: Georgia;</td>
<td class="col3">defines the typeface of an element</td>
</tr>
<tr>
<td class="col1">font-size</td>
<td class="col2">font-size: 16px;</td>
<td class="col3">Controls the size of text displayed</td>
</tr>
<tr>
<td class="col1">font-weight</td>
<td class="col2">font-weight: bold;</td>
<td class="col3">How thin or thick text displays (400 for normal 700 bold)</td>
</tr>
<tr>
<td class="col1">text-align</td>
<td class="col2">text-align: center;</td>
<td class="col3">places text left, right or center of its parent container.</td>
</tr>
<tr>
<td class="col1">text-decoration</td>
<td class="col2">text-decoration: underline;</td>
<td class="col3">changes the decoration of text (underline, overline check mdn for more)</td>
</tr>
<tr>
<td class="col1">color</td>
<td class="col2">color: red;</td>
<td class="col3">defines text color, can also use rgb, hsl & hex(#ff0000)</td>
</tr>
<tr>
<td class="col1">background-color</td>
<td class="col2">background-color: red;</td>
<td class="col3">sets the color behind text</td>
</tr>
<tr>
<td class="col1">opacity</td>
<td class="col2">opacity: 70%</td>
<td class="col3">can make an element transparent (0%)</td>
</tr>
<tr>
<td class="col1">background-image</td>
<td class="col2">background-image: url('https://....soccer.jpeg');</td>
<td class="col3">sets a background image</td>
</tr>
<tr>
<td class="col1">!important</td>
<td class="col2">color: red !important;</td>
<td class="col3">will override any style, don't use it</td>
</tr>
<tr>
<td class="col1">line-height</td>
<td class="col2">line-height: 1.4;</td>
<td class="col3">increases the distance between lines</td>
</tr>
<tr>
<td class="col1">letter-spacing</td>
<td class="col2">letter-spacing: 1px;</td>
<td class="col3">increases the distance between letters in a word</td>
</tr>
</tbody>
</table>
</div>
<div class="container">
<h3>Semantic HTML structure & Misc HTML</h3>
<div class="table-semantic">
<table>
<thead>
<tr>
<th scope="col">Tag Name</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="colsem" colspan="2">Semantic HTML is structured header -> nav -> main -> footer</td>
</tr>
<tr>
<td class="col1"><!DOCTYPE html></td>
<td class="col2">lets browser know what doctype</td>
</tr>
<tr>
<td class="col1"><html></td>
<td class="col2">contains all code</td>
</tr>
<tr>
<td class="col1"><head></td>
<td class="col2">contains the title of the page and other inf</td>
</tr>
<tr>
<td class="col1"><body></td>
<td class="col2">contains all the content</td>
</tr>
<tr>
<td class="col1"><header></td>
<td class="col2">usually for nav links or introductory content such as headings</td>
</tr>
<tr>
<td class="col1"><nav></td>
<td class="col2">for nav bar lists, can go in header or on its own</td>
</tr>
<tr>
<td class="col1"><main></td>
<td class="col2">the dominate content, between nav and footer</td>
</tr>
<tr>
<td class="col1"><footer></td>
<td class="col2">contains contact information etc.</td>
</tr>
<tr>
<td class="col1"><section></td>
<td class="col2">defines elements, such as chapters, headings, or any other area of the document with the same theme.</td>
</tr>
<tr>
<td class="col1"><article></td>
<td class="col2">holds content that makes sense on its own. can hold content such as articles, blogs etc.</td>
</tr>
<tr>
<td class="col1"><figure></td>
<td class="col2">encapsulates media like an image</td>
</tr>
<tr>
<td class="col1"><figcaption></td>
<td class="col2">adds a caption to a figure but is inside <figure> element</td>
</tr>
</tbody>
</table>
</div>
<div class="table-html-misc">
<table>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">HTML Tag</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="col1">Horizontal rule</td>
<td class="col2"><hr></td>
<td class="col3">inserts a horizontal rule to seperate doc, no end tag</td>
</tr>
<tr>
<td class="col1">Break rule</td>
<td class="col2"><br></td>
<td class="col3">inserts a line break which makes the text / imagine following moved to next line</td>
</tr>
</tbody>
</table>
</div>
</div>
<h3>The Box Model</h3>
<div class="table3">
<table>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">CSS Example</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="col1">width & height</td>
<td class="col2">width: 20px; height: 1em;</td>
<td class="col3">width and height of content area</td>
</tr>
<tr>
<td class="col1">padding</td>
<td class="col2">padding: 16px;</td>
<td class="col3">space between content area and border</td>
</tr>
<tr>
<td class="col1">border</td>
<td class="col2">border: 3px solid coral;</td>
<td class="col3">How thin or thick border is, what style of border, and color</td>
</tr>
<tr>
<td class="col1">border-radius</td>
<td class="col2">border-radius: 5px;</td>
<td class="col3">modifies the corner boxes of an element, can use 50% to get a perfect circle</td>
</tr>
<tr>
<td class="col1">padding</td>
<td class="col2">padding: 10px;</td>
<td class="col3">between contents of box and borders, can use padding-top: 10px; or padding: 10px 5px; (top&bot 10, right&left 5)</td>
</tr>
<tr>
<td class="col1">margin</td>
<td class="col2">margin-bottom: 10px;</td>
<td class="col3">the space directly outside of the box, remember margins stack horizontally not vertically</td>
</tr>
<tr>
<td class="col1">auto</td>
<td class="col2">margin: 0 auto;</td>
<td class="col3">centers an element in its containing element, but must have a width (width: 50px)</td>
</tr>
<tr>
<td class="col1">min / max width & height</td>
<td class="col2">min width: 15px </td>
<td class="col3">sets a min / max width for viewability</td>
</tr>
<tr>
<td class="col1">overflow</td>
<td class="col2">overflow: hidden;</td>
<td class="col3">controls what happens to contents that spills outside parent box, visible is default (hidden, scroll, visible)</td>
</tr>
<tr>
<td class="col1">resetting defaults</td>
<td class="col2">* { margin: 0; padding: 0; }</td>
<td class="col3">usually the first css rule in an external stylesheet, resets to default values</td>
</tr>
<tr>
<td class="col1">visibility</td>
<td class="col2">visibility: hidden;</td>
<td class="col3">changes the visibility (hidden, visible, collapse) hidden elements still reserve a space (unlike display: none;)</td>
</tr>
<tr>
<td class="col1">border-box</td>
<td class="col2">* { box-sizing: border-box; }</td>
<td class="col3">usually put at the top, makes the box width the actual width (as opposed to content-box)</td>
</tr>
</tbody>
</table>
</div>
<img src="resources/boxmodel.jpg">
<h3>Display & Position</h3>
<div class="table4">
<table>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">CSS Example</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="col1">static</td>
<td class="col2">position: static;</td>
<td class="col3">the default position</td>
</tr>
<tr>
<td class="col1">relative</td>
<td class="col2">position: relative;</td>
<td class="col3">used in conjunction with top: bottom: left: right: (remember it is offset and doesnt change position of other elements)</td>
</tr>
<tr>
<td class="col1">absolute</td>
<td class="col2">position: absolute;</td>
<td class="col3">will act as if no other elements are present</td>
</tr>
<tr>
<td class="col1">fixed</td>
<td class="col2">position: fixed;</td>
<td class="col3">will sty in a fixed place, like a navbar that stays at the top as the page moves</td>
</tr>
<tr>
<td class="col1">sticky</td>
<td class="col2">position: sticky;</td>
<td class="col3">will move with the screen until it hits a certain spot</td>
</tr>
<tr>
<td class="col1">z-index</td>
<td class="col2">z-index: 3;</td>
<td class="col3">determines which element shows on top, higher number will be shown first</td>
</tr>
<tr>
<td class="col1">inline</td>
<td class="col2">display: inline</td>
<td class="col3">an element will only take up as much space as is needed</td>
</tr>
<tr>
<td class="col1">block</td>
<td class="col2">display: block;</td>
<td class="col3">fill the entire width, but can set their width, they take up an entire line but only need the height necessary for their content</td>
</tr>
<tr>
<td class="col1">inline-block</td>
<td class="col2">display: inline-block;</td>
<td class="col3">combines both features of block and inline; can appear next to each other and specify their dimensions using width and height</td>
</tr>
<tr>
<td class="col1">float</td>
<td class="col2">float: left;</td>
<td class="col3">moves an element as far left or right as possible</td>
</tr>
<tr>
<td class="col1">clear</td>
<td class="col2">clear: both;</td>
<td class="col3">dictates how other elements behave and where they can touch, (both, left, right, none) both meaning neither side can touch another element, none means either side can</td>
</tr>
</tbody>
</table>
</div>
<h3>Improved styling</h3>
<div class="table5">
<table>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">CSS / HTML Example</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="col1">tooltip</td>
<td class="col2"><a href="https:" title="codeacdemy is great">Codecademy</a></td>
<td class="col3">the tooltip displayed when mousing over the link</td>
</tr>
</tbody>
</table>
</div>
<h3>Cursor States & Buttons</h3>
<div class="table6">
<table>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">CSS Example</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="col1">unvisited</td>
<td class="col2">a:link</td>
<td class="col3">how it looks when the link hasnt been clicked yet</td>
</tr>
<tr>
<td class="col1">visited</td>
<td class="col2">a:visited</td>
<td class="col3">how it looks when the link has been clicked and u go back to the page</td>
</tr>
<tr>
<td class="col1">hover</td>
<td class="col2">a:hover</td>
<td class="col3">how the link looks when mousing over it</td>
</tr>
<tr>
<td class="col1">active</td>
<td class="col2">a:active</td>
<td class="col3">how the link looks as the moment it gets clicked</td>
</tr>
<tr>
<td class="col1">button simple</td>
<td class="col2"><div class="button">Click me</div></td>
<td class="col3">bare minimum for a skeuomorphic button (check code)</td>
</tr>
<tr>
<td class="col1">box shadow</td>
<td class="col2">box-shadow: 0px 6px;</td>
<td class="col3">shadow 0px X, 6px y, moves 0px x direction and 6px y direction</td>
</tr>
<tr>
<td class="col1">transition</td>
<td class="col2">transition: color .1s ease-in</td>
<td class="col3">adds a delay to make it seem more seamless check mdn for more</td>
</tr>
</tbody>
</table>
</div>
<h3>Secondary Navigation</h3>
<div class="table7">
<table>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">CSS Example</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="col1">+ & content</td>
<td class="col2">.breadcrumb il+il::before { content: ">" }</td>
<td class="col3">between two touching li elements puts a > </td>
</tr>
<tr>
<td class="col1">Making Arrows</td>
<td class="col2"><div class="arrow-right"></div></td>
<td class="col3">By making 1 side opaque and the rest transparent can make an arrow</td>
</tr>
<tr>
<td class="col1">not</td>
<td class="col2">.site-nav-mobile li:not(:last-child) { }</td>
<td class="col3">looks at all of li elements in its respective list and then applies a specific CSS property to each li that is not :last-child or last list item.</td>
</tr>
</tbody>
</table>
</div>
<h3>Flex box</h3>
<div class="table8">
<table>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">CSS Example</th>
<th scope="col">Description (<span class="red">red</span> for declaration on flex containers only)</th>
</tr>
</thead>
<tbody>
<tr>
<td class="col1">flex</td>
<td class="col2">display: flex;</td>
<td class="col3">changes an element to a block-level container with flex items inside</td>
</tr>
<tr>
<td class="col1">inline-flex</td>
<td class="col2">display: inline-flex;</td>
<td class="col3">allows multiple flex <b>containers</b> to appear inline with each other</td>
</tr>
<tr>
<td class="col1" rowspan="5">justify content</td>
<td class="col2">justify-content: flex-start;</td>
<td class="col3">all items in order, starting from the left, no extra space between before or after</td>
</tr>
<tr>
<td class="col2">justify-content: flex-end;</td>
<td class="col3">positioned in order with last item starting on right of container, no xtra space between before or after</td>
</tr>
<tr>
<td class="col2">justify-content: center;</td>
<td class="col3">all items in order in the center of the container with no xtra space between before or after</td>
</tr>
<tr>
<td class="col2">justify-content: space-around;</td>
<td class="col3">positioned with equal space before and after, resulting in double space between</td>
</tr>
<tr>
<td class="col2">justify-content: space-between;</td>
<td class="col3">equal space between but no space before first or after last elements</td>
</tr>
<tr>
<td class="col1" rowspan="5">align items</td>
<td class="col2">align-items: flex-start;</td>
<td class="col3">positioned at the top of parent container</td>
</tr>
<tr>
<td class="col2">align-items: flex-end;</td>
<td class="col3">positioned at bottom of the parent container</td>
</tr>
<tr>
<td class="col2">align-items: center;</td>
<td class="col3">center of all elements will be positioned halfway between top and bottom of parent</td>
</tr>
<tr>
<td class="col2">align-items: baseline;</td>
<td class="col3">the bottom line of the conent will be aligned with each other (so moved to the point of the lowest item)</td>
</tr>
<tr>
<td class="col2">align-items: stretch;</td>
<td class="col3">if possible items will stretch from top to bottom of a container (default value) elements with a specified height will not stretch, elements with a min height or no height will stretch</td>
</tr>
<tr>
<td class="col1">flex grow</td>
<td class="col2">flex-grow: 1;</td>
<td class="col3">determine by what rate an element will grow along the main axis (horizontal)</td>
</tr>
<tr>
<td class="col1">flex shrink</td>
<td class="col2">flex-shrink: 1;</td>
<td class="col3">same as above but with shrinking (default value is 1)</td>
</tr>
<tr>
<td class="col1">flex basis</td>
<td class="col2">flex-basis: 100px</td>
<td class="col3">determines the starting size of a flex element.</td>
</tr>
<tr>
<td class="col1">flex</td>
<td class="col2">flex: 1 2 100px;</td>
<td class="col3">shortened version: grow shrink basis</td>
</tr>
<tr>
<td class="col1 red" rowspan="3">flex-wrap</td>
<td class="col2">flex-wrap: wrap;</td>
<td class="col3">child elements of a flex container that dont fit will go down a line</td>
</tr>
<tr>
<td class="col2">flex-wrap: wrap-reverse;</td>
<td class="col3">same as wrap, but in a reverse order</td>
</tr>
<tr>
<td class="col2">flex-wrap: nowrap;</td>
<td class="col3">stops items from wrapping, which is the default value</td>
</tr>
<tr>
<td class="col1 red" rowspan="6">align content</td>
<td class="col2">align-content: flex-start;</td>
<td class="col3">all rows of elements will be positioned at the top of parent container</td>
</tr>
<tr>
<td class="col2">align-content: flex-end;</td>
<td class="col3">all rows of elements will be positioned at bottom of the parent container</td>
</tr>
<tr>
<td class="col2">align-content: center;</td>
<td class="col3">all rows of elements will be center of all elements will be positioned halfway between top and bottom of parent</td>
</tr>
<tr>
<td class="col2">align-content: space-between;</td>
<td class="col3">all rows of elements will be spaced evenly from top the bottom with no space above first or below last</td>
</tr>
<tr>
<td class="col2">align-content: space-around;</td>
<td class="col3">all rows of elements will be spaced evenly from top to the bottom of the container with same amount of space at top, bottom and between</td>
</tr>
<tr>
<td class="col2">align-content: stretch;</td>
<td class="col3">if a min height or no height the rows of elements will stretch to fill the parent container from top to bottom (default)</td>
</tr>
<tr>
<td class="col1 red" rowspan="4">flex-direction</td>
<td class="col2">flex-direction: row;</td>
<td class="col3">elements will be positioned from left to right across parent element (default)</td>
</tr>
<tr>
<td class="col2">flex-direction: row-reverse;</td>
<td class="col3">same as wrap, but in a reverse order (right to left)</td>
</tr>
<tr>
<td class="col2">flex-direction: column;</td>
<td class="col3">positioned from top to bottom starting from top left</td>
</tr>
<tr>
<td class="col2">flex-direction: column-reverse;</td>
<td class="col3">positioned from bottom to top starting from bottom left</td>
</tr>
<tr>
<td class="col1 red">flex flow</td>
<td class="col2">flew-flow: columnn wrap</td>
<td class="col3">shorthand for flex-wrap & direction</td>
</tbody>
</table>
</div>
</body>