Skip to content

Commit 69ab6c1

Browse files
Separated exercise 5 into two.
1 parent 104d32d commit 69ab6c1

2 files changed

Lines changed: 57 additions & 42 deletions

File tree

index.html

Lines changed: 56 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ <h2>Padding and Margin</h2>
10321032
<li>1 value means the same amount of padding on all sides</li>
10331033
</ul>
10341034

1035-
<p>Change some of the margin & padding settings below using 1-4 values and see what happens!</p>
1035+
Let's try changing some of the margin & padding settings below using 1-4 values and see what happens!
10361036

10371037
<textarea class="snippet" data-subject="#padding">background: lightblue;
10381038
width: 500px;
@@ -1099,9 +1099,9 @@ <h2>Box Model Review</h2>
10991099
<section class="slide" data-markdown>
11001100
##Box Model Fix!
11011101

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! (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!
11031103

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.
11051105

11061106
```
11071107
/* apply a natural box layout model to all elements, but allowing components to change */
@@ -1113,6 +1113,38 @@ <h2>Box Model Review</h2>
11131113
}
11141114
```
11151115
</section>
1116+
<section class="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.
1140+
1141+
```
1142+
header,
1143+
section {
1144+
padding: 20px 30px;
1145+
}
1146+
```
1147+
</section>
11161148

11171149
<section class="slide title" data-markdown>
11181150
#Inline & Block
@@ -1190,14 +1222,14 @@ <h2>Block & Inline Example</h2>
11901222

11911223
**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.
11921224

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.
11941226
</section>
11951227

11961228
<section class="slide centered">
11971229
<h2>Huh?</h2>
11981230
<img src="framework/img/workshop/huh.gif">
11991231

1200-
<p class="delayed">Not to worry Marky Mark, we can fix it.</p>
1232+
<p class="delayed">Not to worry, we can fix it.</p>
12011233
</section>
12021234

12031235
<section class="slide" data-markdown>
@@ -1218,7 +1250,8 @@ <h2>Huh?</h2>
12181250

12191251
<section class="slide" data-markdown>
12201252
##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.
12221255

12231256
```
12241257
/* apply a natural box layout model to all elements, but allowing components to change */
@@ -1242,63 +1275,44 @@ <h2>Huh?</h2>
12421275
</section>
12431276

12441277
<section class="slide" data-markdown>
1245-
##Exercise #5 - Header & Nav (15 mins)
1278+
##Exercise #5 - Nav Updates (15 mins)
12461279

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.
12481281

12491282
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!
12501283

12511284
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).
12521285

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-
```
12831286
1. Remove default list styles and get each item to line up in a line.
12841287
```
12851288
nav ul {
12861289
list-style-type: none; /* removes bullets */
1287-
margin: 0;
1288-
padding: 0;
1290+
margin: 0; /* removes default margin */
1291+
padding: 0; /* removes default padding */
12891292
}
12901293
nav ul li {
1291-
display: inline-block;
1294+
display: inline-block; /* gets the list items to line up side by side */
12921295
}
12931296
```
12941297
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.
12951298

12961299
```
12971300
nav a {
1301+
display: block; /* changes the element to block */
12981302
padding: 5px 15px;
1299-
text-transform: uppercase;
1303+
text-transform: uppercase;
13001304
}
13011305
```
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:
1310+
1311+
* http://superfamous.com/
1312+
* http://www.gratisography.com/
1313+
* http://littlevisuals.co/
1314+
* http://nos.twnsnd.co/
1315+
* http://unsplash.com/
13021316
</section>
13031317
<section class="slide" data-markdown>
13041318
##Positioning in CSS

project/examples/css/exercise5.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ nav ul li {
6464
display: inline-block;
6565
}
6666
nav a {
67+
display: block;
6768
padding: 5px 15px;
6869
text-transform: uppercase;
6970
}

0 commit comments

Comments
 (0)