-
Notifications
You must be signed in to change notification settings - Fork 0
/
CSS_STRUCTURE.txt
336 lines (141 loc) · 5 KB
/
CSS_STRUCTURE.txt
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
h1 {
color: blue;
}
The above rule set selects the <h1> element.
color: blue; is the CSS declaration.
| \
| \
| \
Property Value
CHANGING FONTS
h1 {
font-family: Garamond;
}
This code would change the font of all h1
headings to Garamond
It is important to note that for a font to
load, it must already be installed on a
user's computer.
If no font-family is defined, HTML will
always default to Times New Roman
Try not to use more than 2 or 3 typefaces
on any webpage.
When the typeface consists of more than one
word, it is a good idea to enclose
the name in quotes (e.g.):
h1 {
font-family: "Courier New";
}
Non User Fonts are fonts which are stored elsewhere
than on the User's computer.
->These can be linked to with the <link> element
or using @font-face.
->Google Fonts is a popular repository of these.
FONT SIZE
font-size
(e.g.) p {
font-size: 18px;
}
px means Pixels
[A pixel is one of several units of measure in web development. It is an absolute
unit equal to 1/96 of an inch.
Rems and ems are scalable typographic units which are commonly used with the font-size property.
As opposed to pixels, both of these units are relative. For example, an em is measured relative
to the font-size of an element. When dealing with ems it is important to realize that the font-size
of an element is often inherited from an ancestor element. On the other hand, rems are determined
based on the font-size of the html element. If font-size is not defined on the html element, the browser’s
default font-size is used instead (usually 16px).
There are pros and cons of each unit but one major advantage of using relative units is that they lend
themselves more naturally to responsive design. Relative units like ems and rems are flexible and scalable whereas pixels are not.]
FONT WEIGHT
font-weight controls how bold or thin a font is. (e.g.):
p {
font-weight: bold;
}
The font would be made bold.
font-weight: bold;
font-weight: bolder;
font-weight: lighter;
font-weight: normal;
This status will selectively turn off any font-weight manipulations.
Try to stick to just bold and normal.
FONT-STYLE
font-style: italic
font-style: normal;
TEXT-DECORATION
text-decoration: underline;
text-decoration: overline;
text-decoration: line-through;
text-decoration: none;
->Underlines should generally only be used for links.
TEXT-TRANSFORM
text-transform: capitalize; Turns the first letter of every word to capital
text-transform: uppercase; Makes all text UPPERCASE
text-transform: lowercase; makes all text lowercase
text-transform: none;
TEXT-SPACING
letter-spacing: normal;
word-spacing: #px;
line-height: length, #px, (# times the font size), %, normal;
TEXT-ALIGN
text-align: left, center, right, justify;
TEXT-INDENT
text-indent: length, %
-> Used for printed media, but rarely for pure webpages.
ALIGNING TEXT
By Default, all text on a browser will be Left-Aligned
text-align: left; center; right
padding-top: 10px;
width: 100%;
MARGINS
&
PADDING
Margin is the space outside of something
Padding is the space inside of something
margin: 20px;
padding: 40px;
->These may also be done as such:
margin-top
margin-right
margin-bottom
margin-left
etc.
BORDERS
border-style: The values can be solid, dotted, dashed, double, groove, ridge, inset and outset;
border-width: #px; or
border-top-width:
border-right-width;
border-bottom-width;
border-left-width;
border-color:
BOX MODEL
https://screenshots.firefox.com/nPzQNWPCcJibKQs9/www.htmldog.com
~/Pictures/images/Screenshot_2018-10-15\ Margins\ and\ Padding\ HTML\ Dog.png
COLOR
The Foreground and Backgroud color can be manipulated, as well as the text color.
color: red;
background-color: green;
(e.g.): h1 {
color: red;
background-color: blue;
}
-> Here the text of the heading will appear red
The Background of the heading will appear blue
Linear Gradients can be used for the colorof the background to make it fade across the page.
background: linear-gradient(-45deg, #C46E41, #00FFD1);
OPACITY
Opacity is the measure of how transparent something is.
It is measured from 0 to 1 (e.g.): .overlay {
opacity: 0.5; [.overlay element would be 50% visible]
}
This can be used to make things fade nicely into each other.
BACKGROUND-IMAGE
background-image
The background can be set to an image stored elsewhere (a url, directory)
.main-banner {
background-image: url("https://www.example.com/image.jpg");
}
or to a relative path
.main-banner {
background-image: url("images/mountains.jpg");
}