-
Notifications
You must be signed in to change notification settings - Fork 0
/
cheatsheet_2.html
370 lines (357 loc) · 12.1 KB
/
cheatsheet_2.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
<!DOCTYPE html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="cheatsheet.js"></script>
<title>Web Development Cheatsheet</title>
<meta
name="keywords"
content="HTML,CSS,JavaScript,Frontend,Cheatsheet,color picker"
/>
<meta name="description" content="cheatsheet for frontend development" />
<link rel="shortcut icon" href="favicon_package/favicon.ico" />
<link
rel="mask-icon"
href="favicon_package/safari-pinned-tab.svg"
color="#6184c9"
/>
<link
rel="apple-touch-icon"
sizes="180x180"
href="favicon_package/apple-touch-icon.png"
/>
<link
href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
/>
<link rel="stylesheet" type="text/css" href="cheatsheet2.css" />
<link
href="https://fonts.googleapis.com/css?family=Raleway:200,300i,400,500"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css?family=Handlee"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css?family=Montserrat:300|Raleway:200,300i,400,500"
rel="stylesheet"
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<div class="container">
<!--Nav Bar-->
<div class="header">
<nav>
<a href="cheatsheet_2.html" onclick="hide()"
><h2 title="go to the top" onclick="hide()">
<!--<i class="fa fa-file-text" aria-hidden="true"></i>--> <span
id="titletext"
>Web Development CheatSheet</span
><span id="title2">Cheatsheet</span>
</h2></a
>
<i class="fa fa-bars" id="bar"></i>
<ul id="menu-list">
<li><a href="cheatsheet_2.html">Home</a></li>
<li class="code">
<a id="codefont" href="#">Code < ></a>
<span id="index">
<a href="#anchor-code2">Deflaut Values</a>
<a href="#anchor-right1">Embeding Files</a>
<a href="#anchor-center">Responsive Design</a>
<a href="#anchor-icon">Adding Icons</a>
</span>
</li>
<li><a href="#anchor-link" onclick="hide()" id="li">Link</a></li>
<span class="dropdown">
<li>
<a onclick="dropDown()"
><span id="v"
>Version <i id="downarrow">▼</i></span
></a
>
</li>
<div id="version">
<a href="cheatsheet.html">Verison 1</a>
<a href="cheatsheet_2.html">Version 2</a>
</div>
</span>
</ul>
</nav>
</div>
<br />
<!--Commonly used code-->
<div id="code" onclick="hide()">
<span id="anchor-code2"></span>
<h3>Change the Default Value</h3>
<p>
<br /><code class="prettyprint">
* {<br>
box-sizing: border-box;<br />
padding: 0;<br />
}<br />
body{<br />
padding: 0;<br />
margin: 0;<br />
}</code
>
</p>
</div>
<br />
<div id="right1" onclick="hide()">
<span id="anchor-right1"></span>
<h3>Embeding Files</h3>
<br />
<i>css file:</i> (inside the head tag) <br /><br />
<code class="prettyprint">
<link rel="stylesheet" type="text/css" href="name.css"><br />
</code>
<br />
</code>
<p>
<i>javascipt file: </i> (inside the <body> or <head>)<br /><br /><code class="prettyprint">
<script src="file_name.js"></script><br />
</code>
</p>
</div>
<br /><br />
<div id="center" onclick="hide()">
<span id="anchor-center"></span>
<a href="#anchor-center"><h3>Responsive Design</h3></a>
<br />
<p>
To create a responsive page, add the line of code inside the head tag:
<br /><br /><code class="prettyprint">
<meta name="viewport" content="width=device-width,
initial-scale=1.0"></code
><br />
<br />when the view point is #px or smaller:<br /><br />
<code class="prettyprint">
@media only screen and (max-width: #px) <br />{<br />
<span class="comment">/* your code here*/</span><br />
}
</code>
<br /><br />When width < height:<br /><br />
<code class="prettyprint"
>@media only screen and (orientation: portrait) <br />{<br />
<span class="comment">/* your code here*/</span><br />}</code
>
<br /><br />
Go to
<a
href="https://css-tricks.com/snippets/css/media-queries-for-standard-devices/"
target="_blank"
id="fa"
>this link</a
>
to check out Media Queries for Standard Devices
</p>
</div>
<br />
<div id="icon" onclick="hide()">
<span id="anchor-icon"></span>
<a href="#anchor-icon"><h3>Add Icons To Webpage</h3></a>
<br />
<p>
To use the
<a href="http://fontawesome.io/icons/" target="_blank" id="fa"
>Font Awesome Icons</a
>, add this line of code inside the head tag: <br /><br />
<code class="prettyprint">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"><br />
<br />
</code>
<br />To use the
<a href="https://material.io/icons/" target="_blank" id="fa"
>Google Icons</a
>, add this line of code inside the head tag:<br /><br />
<code class="prettyprint"
><link
href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet"></code
>
</p>
</div>
<br />
<!--link shortcut-->
<section id="link" onclick="hide()">
<span id="anchor-link"></span>
<center>
<ul id="linkList">
<li id="google">
<a href="https://fonts.google.com/" target="_blank"
>Google Fonts</a
>
</li>
<li id="pink">
<a href="https://www.w3schools.com/" target="_blank">W3School</a>
</li>
<li id="blue1">
<a
href="https://www.w3schools.com/bootstrap/default.asp"
target="_blank"
>Learning Bootstrap</a
>
</li>
<li id="green1">
<a
href="https://websitesetup.org/web-safe-fonts-html-css/"
target="_blank"
>Safe Fonts</a
>
</li>
<li id="doc">
<a href="http://htmlcolorcodes.com/color-picker/" target="_blank"
>Color Picker</a
>
</li>
<li id="pink1">
<a href="http://fontawesome.io/icons/" target="_blank"
>Font Awesome Icons</a
>
</li>
<li id="green2">
<a href="https://www.codecademy.com/learn" target="_blank"
>CodeAcedemy</a
>
</li>
<li id="pink1">
<a href="https://stackoverflow.com/" target="_blank"
>Stackoverflow</a
>
</li>
<li id="purple1">
<a
href="https://github.com/logeshpaul/CSS-Hacks#css-browser-selector"
target="_blank"
>CSS hacks</a
>
</li>
<li id="blue1">
<a href="https://github.com/explore" target="_blank">GitHub</a>
</li>
<li id="pink">
<a
href="https://www.webdesignerexpress.com/blog/css-glyphs-and-html-special-characters.html"
target="_blank"
>Special Characters</a
>
</li>
<li id="blue1">
<a href="https://css-tricks.com/" target="_blank">CSS-TRICKS</a>
</li>
<li id="green">
<a href="https://brajeshwar.github.io/entities/" target="_blank"
>Special Characters II
</a>
</li>
<li id="pink1">
<a href="https://material.io/icons/" target="_blank"
>Google Icons</a
>
</li>
<li id="green2">
<a href="https://www298.lunapic.com/editor/" target="_blank"
>Online Photo Editor</a
>
</li>
<li id="pinkpurple">
<a
href="https://www298.lunapic.com/editor/?action=transparent"
target="_blank"
>Background Remover</a
>
</li>
<li id="blue2">
<a href="https://realfavicongenerator.net/" target="_blank"
>Favicon Generator</a
>
</li>
<li id="green3">
<a href="https://developer.mozilla.org/en-US/" target="_blank">
MDN
</a>
</li>
<li id="purple3">
<a href="https://codepen.io/" target="_blank">CodePen</a>
</li>
<li id="green3">
<a href="https://caniuse.com/" target="_blank">Can I Use...?</a>
</li>
<li id="pink1">
<a href="http://triangle.designyourcode.io/" target="_blank"
>Triangle Generator</a
>
</li>
</ul>
</center>
</section>
<br />
<footer onclick="hide()">
★ ------ coded and designed by Qinyu Chen <font
size="-5px"
color="#B8C7C0"
>• </font
>2018 ------ ★<br /><br />
</footer>
<br />
</div>
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
<script>
var ul = document.getElementById("linkList");
var linkA = ul.getElementsByTagName("li");
console.log(linkA.length);
var requestURL = "https://chloeqino.github.io/link.json";
var request = new XMLHttpRequest();
request.open("GET", requestURL);
request.responseType = "json";
request.send();
request.onload = function () {
var jsonLink = request.response;
newA(jsonLink);
};
var bar = document.getElementById("bar");
var menu = document.getElementById("menu-list");
var a = menu.getElementsByTagName("a");
var index = document.getElementById("index");
console.log(a.length);
function myFunction(x) {
if (x.matches || window.screen.width <= 568) {
// If media query matches
console.log("mobile");
bar.onclick = displayMenu;
menu.style.display = "none";
var height = window.screen.height - 55;
console.log(height);
menu.style.height = height + "px";
for (var i = 2; i < a.length; i++) {
a[i].onclick = function () {
menu.style.display = "none";
bar.setAttribute("class", "fa fa-bars");
};
}
} else {
console.log("not mobile");
menu.style.display = "block";
for (var i = 2; i < a.length; i++) {
a[i].onclick = function () {
menu.style.display = "block";
};
}
menu.style.height = "auto";
}
}
var x = window.matchMedia("(max-width: 568px)");
myFunction(x); // Call listener function at run time
x.addListener(myFunction);
</script>
</body>
</html>