Skip to content

Commit 7d87df7

Browse files
author
Pearl Chen
committed
Tweaks to content.
1 parent 8779993 commit 7d87df7

File tree

7 files changed

+139
-79
lines changed

7 files changed

+139
-79
lines changed
14.4 KB
Loading
19.9 KB
Loading
34.7 KB
Loading
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Home</title>
5+
<link rel="stylesheet" href="styles.css" type="text/css">
6+
</head>
7+
<body>
8+
<div id="centered_on_page">
9+
<header>
10+
<nav>
11+
<div class="nav_button">Home</div>
12+
<div class="nav_button"><a href="about.html">About</a></div>
13+
<div class="nav_button"><a href="contact.html">Contact</a></div>
14+
</nav>
15+
</header>
16+
<section>
17+
Welcome to my blog!
18+
<article>[...Blog Post...]</article>
19+
<article>[...Blog Post...]</article>
20+
</section>
21+
<aside>
22+
[...Sidebar Ad...]
23+
</aside>
24+
<footer>
25+
Copyright 2012
26+
</footer>
27+
</div>
28+
</body>
29+
</html>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
header {
2+
width: 960px;
3+
border: 1px solid gray;
4+
}
5+
6+
footer {
7+
width: 960px;
8+
border: 1px solid gray;
9+
clear: both;
10+
}
11+
12+
section {
13+
width: 640px;
14+
border: 1px solid gray;
15+
float: left;
16+
}
17+
18+
aside {
19+
margin-left: 30px;
20+
width: 290px;
21+
border: 1px solid gray;
22+
float: left;
23+
}
24+
25+
/* apply a natural box layout model to all elements */
26+
* {
27+
-moz-box-sizing: border-box;
28+
-webkit-box-sizing: border-box;
29+
box-sizing: border-box;
30+
}
31+
32+
.nav_button {
33+
font-family: Georgia;
34+
background-color: purple;
35+
color: white;
36+
font-size: 18px;
37+
font-weight: bold;
38+
text-align: center;
39+
padding: 5px 10px 5px 10px;
40+
width: 100px;
41+
text-transform: uppercase;
42+
letter-spacing: 2px;
43+
float: left;
44+
margin-right: 20px;
45+
}
46+
47+
nav {
48+
overflow: auto; /* clear floats */
49+
}
50+
51+
a {
52+
text-decoration: none;
53+
color: gray;
54+
}
55+
56+
a:hover {
57+
text-transform: uppercase;
58+
color: purple;
59+
font-weight: bold;
60+
}
61+
62+
#centered_on_page {
63+
margin: 0 auto;
64+
width: 960px;
65+
}

exercises/website/index-reference.html

Lines changed: 0 additions & 58 deletions
This file was deleted.

index.html

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -339,24 +339,30 @@ <h2>HTML tags</h2>
339339
<article class='slide slide-list'>
340340
<h2>HTML tags</h2>
341341
<p>Tags can be "nested" within other tags, like this:</p>
342-
<p class="centered" style="font-size: 3em;"><code>&lt;tag&gt;&lt;tag&gt;&lt;/tag&gt;&lt;/tag&gt;</code></p>
343-
<pre class='prettyprint'>&lt;!DOCTYPE html&gt;
342+
<p class="centered" style="font-size: 2.5em;"><code>&lt;tag&gt;<span style="font-size: 1.3em; color: purple;">&lt;tag&gt;&lt;/tag&gt;</span>&lt;/tag&gt;</code></p>
343+
344+
<p class="centered sidenote">&lt;title&gt; is nested between &lt;head&gt;. And &lt;head&gt; is nested between &lt;html&gt;</p>
345+
<pre class='prettyprint' style="width: 45%; float: left;">&lt;!DOCTYPE html&gt;
344346
&lt;html&gt;
345-
<strong>&lt;head&gt;</strong>
346-
&lt;title&gt; &lt;/title&gt;
347-
<strong>&lt;/head&gt;</strong>
347+
&lt;head&gt;
348+
<strong>&lt;title&gt;</strong> <strong>&lt;/title&gt;</strong>
349+
&lt;/head&gt;
348350
&lt;body&gt;
349351
&lt;/body&gt;
350352
&lt;/html&gt;</pre>
351-
<pre class='prettyprint'>&lt;!DOCTYPE html&gt;
353+
<pre class='prettyprint' style="width: 45%; float: right;">&lt;!DOCTYPE html&gt;
352354
&lt;html&gt;
353-
&lt;head&gt;
354-
<strong>&lt;title&gt;</strong> <strong>&lt;/title&gt;</strong>
355-
&lt;/head&gt;
355+
<strong>&lt;head&gt;</strong>
356+
&lt;title&gt; &lt;/title&gt;
357+
<strong>&lt;/head&gt;</strong>
356358
&lt;body&gt;
357359
&lt;/body&gt;
358360
&lt;/html&gt;</pre>
361+
<br clear="all" />
359362
<p class="centered sidenote">(This relationship is often referred to using the terms "parent" and "child".)</p>
363+
364+
<p class="centered sidenote"><strong>The innermost tag must be closed before trying to open up a new tag.</strong> <br />
365+
This would be incorrect: &lt;html&gt;&lt;head&gt;&lt;title&gt;&lt;/html&gt;&lt;/head&gt;&lt;/title&gt; </p>
360366
</article>
361367

362368
<!-- SLIDE: HTML -->
@@ -505,6 +511,7 @@ <h2>Tags with attributes</h2>
505511
<ul>
506512
<li><code>href</code> is the <em>attribute</em></li>
507513
<li><code>http://ladieslearningcode.com</code> is the <em>value</em> of that attribute</li>
514+
<li>values are typically surrounded by <em>single or double quotes</em> since occassionally values may contain spaces.</li>
508515
</ul>
509516
</article>
510517

@@ -538,7 +545,10 @@ <h2>Working with images</h2>
538545
<p>In the <code>exercises/2_WORKING_WITH_IMAGES</code> folder, there's a <code>img</code> folder. It's best practice to organize your images into its own folder.</p>
539546
<p>Since the image is <em>not</em> in the same folder as <code>index.html</code>, if you wanted to refer to the image you would need to use a <span class="keyword">relative path</span>.</p>
540547
<pre class="prettyprint">&lt;img src="<strong>img/</strong>llc.gif" /&gt;</pre>
541-
<p class="sidenote">The opposite of this (going <em>up</em> a folder level) would be: <code>src="../img/llc.gif"</code></p>
548+
<p class="sidenote">The opposite of this (going <em>up</em> a folder level) would be:</p>
549+
<pre>src="../img/llc.gif"</pre>
550+
<p class="sidenote">Transvering <em>over</em> to a parallel folder level would be:</p>
551+
<pre>src="../folder/img/llc.gif"</pre>
542552
</article>
543553

544554
<!-- SLIDE: HTML -->
@@ -655,7 +665,7 @@ <h2>Getting ready for Exercise #3</h2>
655665
<li>What's the <strong>very first line</strong> we need to type?</li>
656666
<li>What <strong>three</strong> HTML tags should every website have?</li>
657667
<li>How do I update the browser tab with a descriptive tab name?</li>
658-
<li>In between which tag do I paste this code so it's <strong>visible to the user</strong></li>
668+
<li>In between which tag do I paste this code so it's <strong>visible to the user</strong>?</li>
659669
</ul>
660670
</article>
661671

@@ -745,6 +755,7 @@ <h1>Welcome!</h1>
745755

746756
<h1>Social Media</h1>
747757
<p>Follow me on Twitter!</p>
758+
748759
<style>
749760
h1 { background-color: black; color: white; }
750761
p { font-size: 18apx; }
@@ -812,7 +823,7 @@ <h2>Changing the font family</h2>
812823
<h2>Changing the font family</h2>
813824
<p>Not all fonts are installed on all computers so it's recommended that you use a list of fonts. If the first font in the list isn't available, it will try to use the next.</p>
814825
<pre>body { background: gray; color: white; <strong>font-family: Helvetica, Verdana, Arial, sans-serif;</strong> }</pre>
815-
<p>(Notice how the font-family for the headers are still Courier?)</p>
826+
<p class="sidenote">(Notice how the font-family for the headers are still Courier? That's the "cascading" part of Cascading Style Sheets in action. Inline styles take precedence, then innermost tags, then outer tags.)</p>
816827
</article>
817828

818829
<!-- SLIDE: CSS -->
@@ -828,7 +839,7 @@ <h2>Changing the font size</h2>
828839
<p>Headers have default font-sizes defined by the browser. Let's override them. </p>
829840
<pre>h1 { font-family: Courier; <strong>font-size: 25px;</strong> }
830841
h2 { font-family: Courier; <strong>font-size: 22px;</strong> }</pre>
831-
<p class="sidenote"><a href="http://kyleschaeffer.com/best-practices/css-font-size-em-vs-px-vs-pt-vs/" target="_blank">Click here for more info on font unit sizes.</a></p>
842+
<p class="sidenote">(When you've got more time, read <a href="http://kyleschaeffer.com/best-practices/css-font-size-em-vs-px-vs-pt-vs/" target="_blank">this article</a> for more info on font unit sizes.</p>
832843
</article>
833844

834845
<!-- SLIDE: CSS -->
@@ -995,6 +1006,7 @@ <h1>Header</h1>
9951006
<div>This is text above the header.</div>
9961007
<h1>Header</h1>
9971008
<div>This is text below the header.</div>
1009+
9981010
&lt;style&gt;
9991011
h1 {
10001012
font-family: Courier;
@@ -1023,6 +1035,7 @@ <h1>Header</h1>
10231035
<div>This is text above the header.</div>
10241036
<h1>Header</h1>
10251037
<div>This is text below the header.</div>
1038+
10261039
&lt;style&gt;
10271040
h1 {
10281041
font-family: Courier;
@@ -1047,6 +1060,7 @@ <h1>Header</h1>
10471060
<script type='coder-solution'><div>This is text above the header.</div>
10481061
<h1>Header</h1>
10491062
<div>This is text below the header.</div>
1063+
10501064
&lt;style&gt;
10511065
h1 {
10521066
font-family: Courier;
@@ -1126,16 +1140,16 @@ <h2>Assigning widths</h2>
11261140
<!-- SLIDE: CSS -->
11271141
<article class='slide slide-list'>
11281142
<h2>Assigning widths</h2>
1129-
<p>If our site is 960px wide, then we need to ensure that our columns don't add up to a width greater than 960 - <strong>INCLUDING margins and paddings!</strong>.</p>
1130-
<p><strong><a href="http://paulirish.com/2012/box-sizing-border-box-ftw/" target="_blank">PRO TIP</a>:</strong> Use the box-sizing property for every website you make to make sure your math adds up.</p>
1143+
<p>If our site is 960px wide, we need to ensure that our columns don't exceed 960 - <strong>including margins!</strong> (e.g. 540 + 30 + 290 = 960)</p>
11311144
<pre>
11321145
section {
11331146
width: 560px;
11341147
border: 1px solid gray;
11351148
}
11361149

11371150
aside {
1138-
width: 400px;
1151+
margin-left: 30px;
1152+
width: 290px;
11391153
border: 1px solid gray;
11401154
}
11411155

@@ -1146,6 +1160,7 @@ <h2>Assigning widths</h2>
11461160
box-sizing: border-box;
11471161
}</strong>
11481162
</pre>
1163+
<p class="sidenote"><strong>PRO TIP:</strong> Historically, padding wrecked havoc on our math. To avoid headaches, use the <a href="http://paulirish.com/2012/box-sizing-border-box-ftw/" target="_blank">box-sizing property</a> for every website you make to make sure your math adds up.</p>
11491164
</article>
11501165

11511166
<!-- SLIDE: CSS -->
@@ -1161,7 +1176,8 @@ <h2>Getting columns to be side-by-side</h2>
11611176
}
11621177

11631178
aside {
1164-
width: 400px;
1179+
margin-left: 30px;
1180+
width: 290px;
11651181
border: 1px solid gray;
11661182
<strong>float: left;</strong>
11671183
}
@@ -1171,7 +1187,6 @@ <h2>Getting columns to be side-by-side</h2>
11711187
<!-- SLIDE: CSS -->
11721188
<article class='slide slide-list'>
11731189
<h2>Clearing floats</h2>
1174-
<div>
11751190
<p>You may notice that floats have the ability to affect the rest of the webpage in unexpected ways. It's important to always clear your floats.</p>
11761191
<p>One way is to use the <code>clear</code> property on an element that comes <em>directly</em> after the containers that are floating. Values can be <code>left</code>, <code>right</code>, or <code>both</code>.</p>
11771192
<pre>
@@ -1181,10 +1196,13 @@ <h2>Clearing floats</h2>
11811196
<strong>clear: both;</strong>
11821197
}
11831198
</pre>
1199+
<p>If the elements that are floating are enclosed in another container, you can you apply <code>overflow:auto</code> to the parent container:</p>
1200+
<pre>nav {
1201+
overflow: auto;
1202+
}</pre>
11841203

1185-
<p>Another way is via a line break tag with a clear attribute:</p>
1186-
<pre>&lt;br clear="all" /&gt;</pre>
1187-
</div>
1204+
<p class="sidenote">Another way (when all else fails) is via a line break tag with a clear attribute: <code>&lt;br clear="all" /&gt;</code></p>
1205+
11881206
</article>
11891207

11901208
<!-- SLIDE: CSS -->
@@ -1270,6 +1288,10 @@ <h2>CSS classes</h2>
12701288
float: left;
12711289
margin-right: 20px;
12721290
}
1291+
1292+
nav {
1293+
overflow: auto; /* clear floats */
1294+
}
12731295
&lt;/style&gt;
12741296
</pre>
12751297

@@ -1322,9 +1344,11 @@ <h2>CSS id's</h2>
13221344
&lt;style&gt;
13231345
<strong>#centered_on_page</strong> {
13241346
margin: 0 auto;
1347+
width: 960px;
13251348
}
13261349
&lt;/style&gt;
13271350
</pre>
1351+
<p class="sidenote">I'm going to add this to my <code>exercise/website/index.html</code> file and wrap everything already currently there within the <code>&lt;body&gt;</code> tag.</p>
13281352
</article>
13291353

13301354
<!-- SLIDE: CSS -->

0 commit comments

Comments
 (0)