-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
418 lines (418 loc) · 24.7 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Abel&family=Nerko+One&display=swap" rel="stylesheet">
<link href="style.css" type="text/css" rel="stylesheet" />
<title>HTML and CSS Structure Cheat Sheet Project</title>
</head>
<body>
<header>
<h1>My HTML and CSS Structure Cheat Sheet Project for Codecademy</h1>
</header>
<nav>
<ul>
<li><a href="#htmlstructure">HTML Page Structure</li></a>
<li><a href="#tablestructure">HTML Table Structure</a></li>
<li><a href="#cssstructure">CSS Specificity</a></li>
</ul>
</nav>
<main>
<section>
<a id="htmlstructure"></a><h2>HTML Page Structure</h2>
<p>I often struggle with remembering the order or the structure of things when it comes to writing code. So I created the Cheat Sheet tables below as a reference to come back to when I struggle.
<br><br>
This page isn't that attractive and I'm pretty sure it's frowned upon to put tables, in tables in tables but using tables was the aim of the project so, please forgive me.
<br><br>
Feedback and constructive criticism welcome!
</p>
<table class="structuretable">
<thead>
<tr>
<th>Name</th>
<th>Element Meaning</th>
<th>Used For</th>
</tr>
</thead>
<tbody>
<tr>
<td class="element"><html></td>
<td>HTML stands for Hypertext Markup Language</td>
<td>Tells the browser that this is an HTML file so it can display it</td>
</tr>
<tr>
<td class="element"><head></td>
<td>Used at the top of the page as a header</td>
<td>Invisible to the user, contains links to fonts, styles and other information browsers and search engines need</td>
</tr>
<tr>
<td class="element"><meta...></td>
<td>Metadata is data (information) about data.</td>
<td>Meta name, content etc</td>
</tr>
<tr>
<td class="element"><link...></td>
<td>Connects to something external to use it on the page</td>
<td>Linking style sheets (CSS), fonts etc</td>
</tr>
<tr>
<td class="element"><title></td>
<td>Name of the page</td>
<td>Descriptive name that Google can process and also displays in browser tabs</td>
</tr>
<tr>
<td class="element"><body></td>
<td>Defines the document's body. There can only be one.</td>
<td>Contains the content of the page that can be seen and read</td>
</tr>
<tr>
<td class="element"><nav></td>
<td>Short for 'navigation'</td>
<td>Used for menus that help users navigate the page or site</td>
</tr>
<tr>
<td class="element"><main></td>
<td>The main part of the content that the page has been made for</td>
<td>Everything that the page's title describes - the text, images other media and more.</td>
</tr>
<tr>
<td class="element"><section></td>
<td>A part within the main content</td>
<td>Breaks up the page's content so the page can be easily read in HTML</td>
</tr>
<tr>
<td class="element"><article></td>
<td>A self-contained part of the page's dialogue</td>
<td>Used for content that can stand alone on the page</td>
</tr>
<tr>
<td class="element"><aside></td>
<td>Content that is positioned to the side</td>
<td>Mainly used for sidebars</td>
</tr>
<tr>
<td class="element"><footer></td>
<td>The section at the bottom of a page</td>
<td>Contains anything you need to appear after the main content and is the same on every page eg, a secondary menu or contact details</td>
</tr>
</tbody>
</table>
<br><br>
<table class="exampletable">
<tbody>
<tr>
<td><html></td>
</tr>
<tr>
<td>
<table class="exampletable insiderows">
<tbody>
<tr>
<td><head></td>
</tr>
<tr>
<td>
<table class="exampletable insideinsiderows">
<tr>
<td><meta...></td>
</tr>
<tr>
<td><link...></td>
</tr>
<tr>
<td><title></title></td>
</tr>
</table class="exampletable">
</td>
</tr>
<tr>
<td></head></td>
</tr>
</tbody>
</table>
<table class="exampletable insiderows">
<tbody>
<tr>
<td><body></td>
</tr>
<tr>
<td>
<table class="exampletable insideinsiderows">
<tr>
<td><nav></nav></td>
</tr>
<tr>
<td><main></td>
</tr>
<tr>
<td>
<table class="exampletable insideinsideinsiderows">
<tbody>
<tr>
<td rowspan="3" id="spancell"><aside></aside></td>
</tr>
<tr>
<td><section></section></td>
</tr>
<tr>
<td><article></article></td>
</tr>
</tbody>
</table>
</td>
<tr>
<td></main></td>
</tr>
</tr>
<tr>
<td><footer></footer></td>
</tr>
</table class="exampletable">
</td>
</tr>
<tr>
<td></body></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td></html></td>
</tr>
</tbody>
</table>
</section>
<br><br>
<section>
<a id="tablestructure"></a><h2>HTML Table Structure</h2>
<table class="structuretable">
<thead>
<tr>
<th>Name</th>
<th>Element Meaning</th>
<th>Used For</th>
</tr>
</thead>
<tbody>
<tr>
<td class="element"><table></td>
<td>Establishes your table to the browser</td>
<td>Used to display content in cells organised in rows and columns</td>
</tr>
<tr>
<td class="element"><thead></td>
<td>Much like the <header> element but for tables</td>
<td>Contains the header cells. They can easily be styled differently.</td>
</tr>
<tr>
<td class="element"><th></td>
<td>The table's header cells</td>
<td>Use this element to mark the titles of your columns and rows and give them a different style</td>
</tr>
<tr>
<td class="element"><tbody></td>
<td>Establishes this is the main content of your table </td>
<td>Much like the <body> element for the page.</td>
</tr>
<tr>
<td class="element"><tr></td>
<td>This is the table-row element.</td>
<td>Starts a new row for your table</td>
</tr>
<tr>
<td class="element"><td></td>
<td>These are the table-data cells of your table.</td>
<td>Each new <td> starts a new cell in the same row. In the first row, it sets out your columns.</td>
</tr>
<tr>
<td class="element"><tfoot></td>
<td>Specifies the footer part of your table</td>
<td>Often used to display totals of columns etc.</td>
</tr>
</tbody>
</table>
</br><br>
<table class="exampletable">
<tbody>
<tr>
<td><table></td>
</tr>
<tr>
<td>
<table class="exampletable insiderows">
<tbody>
<tr>
<td><thead></td>
</tr>
<tr>
<td>
<table class="exampletable insideinsiderows">
<tr>
<td><tr></td>
</tr>
<tr>
<td>
<table class="exampletable insideinsideinsiderows">
<tr>
<td id="spancell"><th></th></td>
<td id="spancell"><th></th></td>
<td id="spancell"><th></th></td>
</tr>
</table>
</td>
</tr>
<tr>
<td></tr></td>
</tr>
</table class="exampletable">
</td>
</tr>
<tr>
<td></thead></td>
</tr>
<tr>
<td><tbody></td>
</tr>
<tr>
<td>
<table class="exampletable insideinsiderows">
<tr>
<td><tr></td>
</tr>
<tr>
<td>
<table class="exampletable insideinsideinsiderows">
<tr>
<td id="spancell"><td></td></td>
<td id="spancell"><td></td></td>
<td id="spancell"><td></td></td>
</tr>
</table>
</td>
</tr>
<tr>
<td></tr></td>
</tr>
</table class="exampletable">
</td>
</tr>
<tr>
<td></tbody></td>
</tr>
<tr>
<td><tfoot></td>
</tr>
<tr>
<td>
<table class="exampletable insideinsiderows">
<tr>
<td><tr></td>
</tr>
<tr>
<td>
<table class="exampletable insideinsideinsiderows">
<tr>
<td id="spancell"><th></th></td>
<td id="spancell"><th></th></td>
<td id="spancell"><th></th></td>
</tr>
</table>
</td>
</tr>
<tr>
<td></tr></td>
</tr>
</table class="exampletable">
</td>
</tr>
<tr>
<td></tfoot></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td></table></td>
</tr>
</tbody>
</table>
</section>
<section>
<a id="cssstructure"></a><h2>CSS Structure</h2>
<p>I know CSS specificity isn't strictly 'structure' but it is still a sequence that needs to be memorised so that you are able to write CSS that flows correctly and is easy to use.
<br><br>
There are also many more CSS Selectors that I didn't include but the table was getting difficult to handle as it was. Maybe this is something I can add in the future.
<br><br>
If you're really interested in CSS Specificity then I highly recommend you look into how you can <a href="https://css-tricks.com/specifics-on-css-specificity/" target="_blank">'Calculate' it and give it a value</a> as explained here by <a href="css-tricks.com" target="_blank">CSS Tricks</a>. As an amateur, I thought this was really interesting.
</p>
<table class="structuretable">
<thead>
<tr>
<th>Name</th>
<th>Example</th>
<th colspan="6">Specificity</th>
</tr>
</thead>
<tbody>
<tr>
<td class="element"><element></td>
<td>body, h1, div, p</td>
<td colspan="1" class="insiderows"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td class="element">.class, :pseudo-class</td>
<td>.banner, :active</td>
<td colspan="2" class="insiderows"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td class="element">#id</td>
<td>#extraspace</td>
<td colspan="3" class="insiderows"></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td class="element">CSS Sheet Order</td>
<td>.example {color:green;} .example {color:blue} blue wins</td>
<td colspan="4" class="insiderows"></td>
<td></td>
<td></td>
</tr>
<tr>
<td class="element">Inline Styling</td>
<td><h1> style=""...</td>
<td colspan="5" class="insiderows"></td>
<td></td>
</tr>
<tr>
<td class="element">!important Tag</td>
<td>color: red!important;</td>
<td colspan="6" class="insiderows"></td>
</tr>
</tbody>
</table>
<br><br>
</section>
</main>
<footer>
<div class="contact-details">
<h3><a href="https://github.com/Signy3">Github Page: Signy3</a></h3>
</div>
</footer>
</body>
</html>