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
These default display styles can be changed using the CSS `display` property.
1179
+
1180
+
`display: inline` can be used to get block level elements to line up side by side, in a line.
1181
+
1182
+
`display: block` can be used to make inline elements behave like a block level element
1183
+
1184
+
`display: inline-block` is the best of both worlds. Elements will line up side by side, like inline elements and also render sizing properties like block elements.
1185
+
1186
+
`display: none;` will hide the element.
1187
+
</section>
1188
+
1180
1189
<sectionclass="slide">
1181
1190
<h2>Block & Inline Example</h2>
1182
1191
<p>Suppose we had this HTML below. See how the same property and values give different results based on the element. Go ahead and update the CSS values to see how it changes.</p>
<spanid="inline">I'm a span so that makes me an inline element.</span>
1196
-
</section>
1197
-
1198
-
<sectionclass="slide" data-markdown>
1199
-
##CSS Display property
1200
1206
1201
-
These default display styles can be changed using the CSS `display` property.
1202
-
1203
-
`display: inline` can be used to get block level elements to line up side by side, in a line.
1204
-
1205
-
`display: block` can be used to make inline elements behave like a block level element
1206
-
1207
-
`display: inline-block` is the best of both worlds. Elements will line up side by side, like inline elements and also render sizing properties like block elements.
1208
-
1209
-
`display: none;` will hide the element.
1210
-
1211
-
Let's go back to the previous slide's example and try using the `display` property.
1207
+
<divclass="presenter-notes">
1208
+
<p>Update the span example to inline-block and block to demonstrate the differences</p>
1209
+
</div>
1212
1210
</section>
1213
1211
1212
+
1214
1213
<sectionclass="slide" data-markdown>
1215
1214
##Exercise #5 - Nav Updates (15 mins)
1216
1215
@@ -1382,10 +1381,25 @@ <h2>Float, Clear And Clearfix</h2>
1382
1381
```
1383
1382
</section>
1384
1383
1384
+
<sectionclass="slide" data-markdown>
1385
+
##Add a quote
1386
+
1387
+
Before we practice using classes and floats, let's just add a bit more content to our **About** page. In the final example, a quote has been added for some extra personalization. Also, adding more content to the page will make it longer, therefore scrollable, which we'll need for a later exercise.
1388
+
1389
+
Let's add a quote using the `blockquote` and `cite` tag. Feel free to use the example below, your own or one of the lorem ipsums. Add it under the paragraphs and below the closing `section` tag.
1390
+
1391
+
```xml
1392
+
<blockquote>
1393
+
<p>The more that you read, the more things you will know. The more that you learn, the more places you'll go.</p>
1394
+
<cite>― Dr. Seuss, I Can Read With My Eyes Shut!</cite>
1395
+
</blockquote>
1396
+
```
1397
+
</section>
1398
+
1385
1399
<sectionclass="slide" data-markdown>
1386
1400
##Class Exercise - classes and floats
1387
1401
1388
-
Add a class of "profile-image" to the image tag in your **About** page. Then in your css file, add a new comment block at the bottom of the page for your **About** page styles. Then add a float to get the text to wrap around the image.
1402
+
Add a "profile-image" class to the image tag in your **About** page. Then in your css file, add a new comment block at the bottom of the page for your **About** styles. Then `float` to get the text to wrap around the image.
1389
1403
1390
1404
```css
1391
1405
/* ABOUT PAGE
@@ -1403,19 +1417,32 @@ <h2>Float, Clear And Clearfix</h2>
1403
1417
margin-right: 20px;
1404
1418
}
1405
1419
1406
-
That looks much better but look what happened to the footer! All elements that come after floated elements want to float too as long as there is space for them. Let's put the page back to its natural stacking order by *clearing the float*. Put the `clear` on the footer element because that's where we want things to go back to normal.
1420
+
That looks much better but look what happened to the quote and the footer! All elements that come after floated elements want to float too as long as there is space for them. Let's put the page back to its natural stacking order by *clearing the float*. Put the `clear` on the `blockquote` element because that's where we want things to go back to normal. Let's add a class to it as well, in the HTML.
1407
1421
1408
-
```css
1409
-
/* FOOTER
1410
-
-----------------------------------------*/
1411
-
footer {
1422
+
```xml
1423
+
<blockquote class="quote">
1424
+
...
1425
+
</blockquote>
1426
+
```
1427
+
```
1428
+
.quote {
1429
+
clear: both;
1430
+
}
1431
+
```
1432
+
1433
+
While we're here, let's update it by center aligning the quote and add some spacing.
1434
+
1435
+
```
1436
+
.quote {
1412
1437
clear: both;
1438
+
text-align: center;
1439
+
padding-top: 20px;
1413
1440
}
1414
1441
```
1415
1442
1416
1443
Your page should now look similar to [exercise6a-about.html](project/examples/exercise6a-about.html).
1. Position the nav to the top right of the header element.
1502
-
1503
-
```
1504
-
nav {
1505
-
position: absolute;
1506
-
right: 20px;
1507
-
top: 20px;
1508
-
}
1509
-
```
1528
+
Position the nav to the top right of the header element.
1510
1529
1511
-
1. The entire header itself should be set to fixed positioning so when you scroll the page, it stays fixed at the top.
1512
-
```
1513
-
header {
1514
-
position: fixed;
1515
-
}
1516
-
```
1517
-
Notice that adding this property changes the page. When you position an element, it automatically becomes the width of its content. Set the width to 100% so it becomes as wide as the browser.
1530
+
header {
1531
+
position: relative;
1532
+
}
1533
+
nav {
1534
+
position: absolute;
1535
+
right: 20px;
1536
+
top: 20px;
1537
+
}
1518
1538
1519
-
Also, set the background to white so the content underneath doesn't show through when you scroll the page. Add a border on the bottom to create a separation of the header from the page content.
1520
1539
1521
-
```
1522
-
header {
1523
-
position: fixed;
1524
-
width: 100%;
1525
-
background: white;
1526
-
}
1527
-
```
1528
-
1. Positioning takes the element out of the natural stacking order. See how the profile picture "jumped" underneath the header when position: fixed was applied? It's because it doesn't "see" that there's an element before it, so it wants to slide up to the next available slot. Add some padding on the top of the section element to push the content down below the fixed header.
1529
-
```
1530
-
section {
1531
-
padding-top: 125px;
1532
-
}
1533
-
```
1540
+
The *entire* header itself should be set to fixed positioning so when you scroll the page, it stays fixed at the top.
1541
+
1542
+
header {
1543
+
position: fixed;
1544
+
}
1545
+
1546
+
Notice that adding this property changes the page. When you position an element, it automatically becomes the width of its content. Set the width to 100% so it becomes as wide as the browser.
1547
+
1548
+
Also, set the background to white so the content underneath doesn't show through when you scroll the page. Add a border on the bottom to create a separation of the header from the page content.
1549
+
1550
+
1551
+
header {
1552
+
position: fixed;
1553
+
width: 100%;
1554
+
background: white;
1555
+
border-bottom: 1px solid #eee;
1556
+
}
1557
+
1558
+
Positioning takes the element out of the natural stacking order. See how the profile picture "jumped" underneath the header when position: fixed was applied? It's because it doesn't "see" that there's an element before it, so it wants to slide up to the next available slot. Add some padding on the top of the section element to push the content down below the fixed header.
1559
+
1560
+
section {
1561
+
padding-top: 125px;
1562
+
}
1563
+
1534
1564
1535
-
Your page should look like [example 6](project/examples/exercise6-about.html). Note how the header looks the same on all three pages now... except the home page! Where did the navigation disappear off to?
1565
+
Your page should look like [example 6](project/examples/exercise6-about.html). Note how the header looks the same on all three pages now... except the home page! Where did the navigation disappear off to?
Copy file name to clipboardExpand all lines: project/examples/exercise6a-about.html
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,11 @@ <h2>Hello!</h2>
28
28
<p>[Personal summary or life story here] Lorem ipsum dolor sit amet, consectetur adipisicing elit. Debitis laboriosam officia blanditiis tempora sit fugiat molestiae iusto impedit ipsa cum, asperiores laborum, esse, doloribus explicabo! Autem, distinctio provident itaque non.</p>
29
29
<p>Links to stuff about you, if needed. <ahref="#">Link example</a> and <ahref="#">another link example</a>.</p>
30
30
<p>Or another paragraph! Lorem ipsum dolor sit amet, consectetur adipisicing elit. Neque maiores dolor id voluptatibus iure eum hic similique, cum impedit possimus nesciunt deleniti atque fugiat. Nesciunt in ipsum voluptatem debitis nihil!</p>
31
+
32
+
<blockquoteclass="quote">
33
+
<p>The more that you read, the more things you will know. The more that you learn, the more places you'll go.</p>
34
+
<cite>― Dr. Seuss, I Can Read With My Eyes Shut!</cite>
0 commit comments