-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcss.html
More file actions
264 lines (230 loc) · 6.13 KB
/
css.html
File metadata and controls
264 lines (230 loc) · 6.13 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
<!DOCTYPE html>
<html>
<head>
<title>CSS Cheat Sheet</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<link rel="stylesheet" href="cheatsheet.css" />
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500|Roboto+Slab:300,400,700|Lobster" rel="stylesheet" />
<script src="copy.js" defer></script>
</head>
<body>
<header>
<h1>NCSS Cheat Sheets</h1>
<nav class="sheet-nav">
<a href="html.html">HTML</a>
<a class="selected" href="css.html">CSS</a>
<a href="design.html">Design</a>
<a href="profile.html">Example</a>
</nav>
<aside>(Click on the left column to copy to your clipboard)</aside>
</header>
<details>
<summary><h2>Sample CSS File</h2></summary>
<p>A CSS file that changes basic styles:</p>
<pre><code><aside data-aside="selector">p { </aside>
font-family: 'Roboto', Sans-Serif;
<aside data-aside="attribute">font-size: 12px; </aside>
}
.james {
background: red;
}</code></pre>
</details>
<figure class="cheatsheet wide">
<figcaption>Selectors</figcaption>
<code>
#james { ... }
</code>
<template>
#james {
}
</template>
<article>
<p>Select the identified element <code><p id="james"></code></p>
</article>
<code>
.curran { ... }
</code>
<template>
.curran {
}
</template>
<article>
<p>Select elements of <code><p class="curran"></code></p>
</article>
<code>
section { ... }
</code>
<template>
section {
}
</template>
<article>
<p>Select all <code><section></code> elements</p>
</article>
</figure>
<figure class="cheatsheet wide">
<figcaption>Colors</figcaption>
<code>
red, blue, green
</code>
<template>
pink
</template>
<article>
<p>HTML has many "built-in" <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Values">color keywords</a> to choose from</p>
</article>
<code>
rgb(<span style="color: red">0</span>, <span style="color: green">255</span>, <span style="color: blue">0</span>)
</code>
<template>
rgb(255, 0, 0)
</template>
<article>
<p>Specify colors with three parts: red, green, and blue, all between <code>0</code> (least) and <code>255</code> (most)
</article>
<code>
rgba(<span style="color: red">0</span>, <span style="color: green">255</span>, <span style="color: blue">0</span>,<span style="opacity: 0.5">0.5</span>)
</code>
<template>
rgba(0, 255, 0, 0.5)
</template>
<article>
<p>Add a fourth part in <code>rgba</code> showing how <span style="opacity: 0.5">transparent</span> the color is</p>
</article>
<code>
#<span style="color: red">ff</span><span style="color: green">00</span><span style="color: blue">ff</span>
</code>
<template>
#ff00ff
</template>
<article>
<p>You can also use hexadecimal values between <code>00</code> and <code>ff</code></p>
</article>
</figure>
<figure class="cheatsheet wide">
<figcaption>Text Attributes</figcaption>
<code class="small">
font-family: 'Roboto';
</code>
<template>
font-family: 'Roboto', Sans-Serif;
</template>
<article>
<p>Change font <span style="font-family: 'Lobster', Cursive;">family</span></p>
</article>
<code class="small">
font-size: 20px;
</code>
<template>
font-size: 20px;
</template>
<article>
<p>Change font <span style="font-size: 20px">size</span></p>
</article>
<code class="small">
text-align: center;
</code>
<template>
text-align: center;
</template>
<article style="justify-content: center;">
<p>Align text to <code>left</code>, <code>right</code>, or <code>center</code></p>
</article>
<code class="small">
text-decoration: none;
</code>
<template>
text-decoration: none;
</template>
<article>
<p>Set the decoration to
<code style="text-decoration: underline">underline</code>,
<code style="text-decoration: strikethrough">strikethrough</code>, or (very useful)
<code>none</code></p>
</article>
<code class="small">
text-shadow: 0 2px 0 grey;
</code>
<template>
text-shadow: 0 2px 0 grey;
</template>
<article>
<p>Add text <span style="text-shadow: 0 2px 0 grey">shadow</span>, made up of four parts: left, down, blur and color</p>
</article>
</figure>
<figure class="cheatsheet wide">
<figcaption>Presentation Attributes</figcaption>
<code style="color: red">
color: red;
</code>
<template>
color: red;
</template>
<article>
<p>Font color</p>
</article>
<code>
<span style="background: blue; color: white">background: blue;</span>
</code>
<template>
background: blue;
</template>
<article>
<p>Background color</p>
</article>
<code class="small">
border: 2px dashed red;
</code>
<template>
border: 2px dashed red;
</template>
<article>
<p>Set a <span style="border: 2px dashed red">border</span>: it can be of type <code>solid</code>, <code>dashed</code>, or <code>dotted</code></p>
</article>
<code class="small">
<span style="background: blue; border-radius: 10px; padding: 4px 8px; color: white;">border-radius: 10px;</span>
</code>
<template>
border-radius: 10px;
</template>
<article>
<p>Border radius (round borders)—works even without <code>border:</code></p>
</article>
</figure>
<figure class="cheatsheet wide">
<figcaption>Layout Attributes</figcaption>
<code>
padding: 16px;
</code>
<template>
padding: 16px;
</template>
<article>
<p>Give an element <span style="background: #eee; padding: 10px;">padding</span></p>
</article>
<code>
margin: 16px;
</code>
<template>
margin: 16px;
</template>
<article>
<p>Give an element <span style="background: #fff; margin: 16px;">margin</span></p>
</article>
<code>
display: grid;
</code>
<template>
display: grid;
</template>
<article>
<p>Set display mode (ask tutors for more information)</p>
</article>
</figure>
<copy-element id="copy"></copy-element>
<script>
document.body.addEventListener('code', (ev) => copy.copy(ev.detail));
</script>
</body>
</html>