You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Luckily, there’s a fix for this. Enter the [box-sizing: border-box](http://www.paulirish.com/2012/box-sizing-border-box-ftw/) fix ftw! (Updated Aug 2014)
1102
+
Luckily, there’s a fix for this. Enter the [box-sizing: border-box](http://www.paulirish.com/2012/box-sizing-border-box-ftw/) fix ftw!
1103
1103
1104
-
It is recommended to add this snippet to all your projects.
1104
+
It is recommended to add this snippet to all your projects. Let's add it to our CSS file now. Add it at the very top of the file since it's a global style.
1105
1105
1106
1106
```
1107
1107
/* apply a natural box layout model to all elements, but allowing components to change */
@@ -1113,6 +1113,38 @@ <h2>Box Model Review</h2>
1113
1113
}
1114
1114
```
1115
1115
</section>
1116
+
<sectionclass="slide" data-markdown>
1117
+
##Class Exercise - Update the Header
1118
+
1119
+
1. Remove the default space from the `h1` and `h2` and set the line-height.
1120
+
1121
+
```
1122
+
h1, h2 {
1123
+
font-weight: 300;
1124
+
text-transform: uppercase;
1125
+
margin: 0; /* removes default space */
1126
+
line-height: 1; /* tightens up the space between the headings */
1127
+
}
1128
+
```
1129
+
1. Set the size for only the headings in the header.
1130
+
1131
+
```
1132
+
header h1 {
1133
+
font-size: 36px;
1134
+
}
1135
+
header h2 {
1136
+
font-size: 18px;
1137
+
}
1138
+
```
1139
+
1. Add padding to `header` and `section` so there's an equal amount of space around the content blocks.
**However**, we have to break the natural stacking flow when an element is floated. This will cause any element *after* the floated element to try to move up beside it or just not display properly because we've disrupted the natural stacking flow. The parent container will also collapse.
1192
1224
1193
-
**Also**, if there is no width set, the element will float but the width will automatically be the width of its content.
1225
+
**Also**, if no width is set, the element will float but the width will automatically be the width of its content.
1194
1226
</section>
1195
1227
1196
1228
<sectionclass="slide centered">
1197
1229
<h2>Huh?</h2>
1198
1230
<imgsrc="framework/img/workshop/huh.gif">
1199
1231
1200
-
<pclass="delayed">Not to worry Marky Mark, we can fix it.</p>
1232
+
<pclass="delayed">Not to worry, we can fix it.</p>
1201
1233
</section>
1202
1234
1203
1235
<sectionclass="slide" data-markdown>
@@ -1218,7 +1250,8 @@ <h2>Huh?</h2>
1218
1250
1219
1251
<sectionclass="slide" data-markdown>
1220
1252
##Update CSS file
1221
-
Before moving onto the next exercise, let's add that [box-sizing fix](http://www.paulirish.com/2012/box-sizing-border-box-ftw/) as well as the [clearfix class](http://nicolasgallagher.com/micro-clearfix-hack/) to our CSS file. Put this at the very top since they are global styles.
1253
+
1254
+
Before moving onto the next exercise, let's add the [clearfix class](http://nicolasgallagher.com/micro-clearfix-hack/) to our CSS file after the box model fix.
1222
1255
1223
1256
```
1224
1257
/* apply a natural box layout model to all elements, but allowing components to change */
@@ -1242,63 +1275,44 @@ <h2>Huh?</h2>
1242
1275
</section>
1243
1276
1244
1277
<sectionclass="slide" data-markdown>
1245
-
##Exercise #5 - Header & Nav (15 mins)
1278
+
##Exercise #5 - Nav Updates (15 mins)
1246
1279
1247
-
Follow the instructions below as far as you can. Check these changes on either the About or Contact page. The Home page will be styled after since it's different from the other two pages.
1280
+
Follow the instructions below. Check these changes on either the About or Contact page. The Home page will be styled later since it's different.
1248
1281
1249
1282
Though all the CSS is listed, try adding in one line at a time to see and understand what each property does. Feel free to leave comments for yourself in the code to explain what each line is doing!
1250
1283
1251
1284
There's a couple more concepts to go through to finish styling the header and nav, so your page should look like [example 5](project/examples/exercise5-about.html).
1252
1285
1253
-
**Bonus**: If you finish early, take some time to find a background image or pick on from the images folder or add some comments to your CSS to organize it. See [sample here](project/examples/css/exercise5.css).
1254
-
1255
-
1. Remove the default space from the `h1` and `h2` and set the font size.
1256
-
1257
-
```
1258
-
h1, h2 {
1259
-
font-weight: 300;
1260
-
text-transform: uppercase;
1261
-
margin: 0; /* removes default space */
1262
-
line-height: 1; /* tightens up the space between the headings */
1263
-
}
1264
-
```
1265
-
1. Set the size for only the headings in the header.
1266
-
1267
-
```
1268
-
header h1 {
1269
-
font-size: 36px;
1270
-
}
1271
-
header h2 {
1272
-
font-size: 18px;
1273
-
}
1274
-
```
1275
-
1. Add padding to `header` and `section` so there's an equal amount of space around the content blocks.
1276
-
1277
-
```
1278
-
header,
1279
-
section {
1280
-
padding: 20px 30px;
1281
-
}
1282
-
```
1283
1286
1. Remove default list styles and get each item to line up in a line.
1284
1287
```
1285
1288
nav ul {
1286
1289
list-style-type: none; /* removes bullets */
1287
-
margin: 0;
1288
-
padding: 0;
1290
+
margin: 0; /* removes default margin */
1291
+
padding: 0; /* removes default padding */
1289
1292
}
1290
1293
nav ul li {
1291
-
display: inline-block;
1294
+
display: inline-block; /* gets the list items to line up side by side */
1292
1295
}
1293
1296
```
1294
1297
1. Add some space around the links. It's better to put padding on the anchor link rather the the list item because padding adds space on the *inside*. Putting it on the link with make the click area bigger.
1295
1298
1296
1299
```
1297
1300
nav a {
1301
+
display: block; /* changes the element to block */
1298
1302
padding: 5px 15px;
1299
-
text-transform: uppercase;
1303
+
text-transform: uppercase;
1300
1304
}
1301
1305
```
1306
+
1307
+
**Bonus**:
1308
+
If you have some extra time, try adding some comments to your CSS to organize it. See [sample here](project/examples/css/exercise5.css).
1309
+
Find a background image for later or choose one from the **images** folder. Here are some resources:
0 commit comments