-
Notifications
You must be signed in to change notification settings - Fork 0
/
lab_020.html
99 lines (93 loc) · 4.74 KB
/
lab_020.html
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
<!doctype html>
<html lang="en">
<head>
<title>
Lab 20 - Spans and Divs
</title>
<meta charset="UTF-8" />
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
<meta "="" content=" width=device-width, initial-scale=1.0" name="viewport" />
<meta content="A guided tour through the fundamentals of Git, HTML, & CSS" name=" description" />
<meta content="#0000ff" name="theme-color" />
<link href="manifest.json" rel="manifest" />
<link href="css/reset.css" media="screen" rel="stylesheet" />
<link href="css/screen.css" media="screen" rel="stylesheet" />
<link href="css/prism.css" rel="stylesheet" />
</head>
<body data-lab-id="20">
<a class="skip-to-content" href="#content" tabindex="1">
Skip to content
</a>
<main class="layout">
<nav id="index">
<p class="link-home">
<a href="index.html">
<span>Hack4Impact Starter Pack</span>
</a>
</p>
<button class="link-menu">
Menu
</button>
<nav tabindex="0">
<ol>
</ol>
</nav>
</nav>
<div id="content" tabindex="-1">
<h1 class="lab_title">
<em>Lab 20</em>
Spans and Divs
</h1>
<h2>Goals</h2>
<ul>
<li>Learn about <code class="language-html"><span></code> and <code
class="language-html"><div></code></li>
<li>Add <code class="language-html"><div></code> to your personal website</li>
</ul>
<h2>Generics Containers</h2>
<p><code class="language-html"><span></code> and <code class="language-html"><div></code> are generic
containers for content that don't have any semantic meaning to them. Although we will continue to stress the
importance of writing HTML that provides meaning and structure to a page, <em>sometimes</em> we need a
catch-all,
generic solution for content that is not easily categorizable into one of the existing HTML tags.</p>
<p>Often, you will attach a <strong>class attribute</strong> or <strong>id attribute</strong> to the <code
class="language-html"><span></code> or <code class="language-html"><div></code>. If you remember
from Lab 16, this is so we can reference specific attributes in our CSS and select those specific classes or ids
for styling.</p>
<p>The main difference between <code class="language-html"><span></code> and <code
class="language-html"><div></code> is that <code class="language-html"><span></code> are
<strong>in-line</strong> while <code class="language-html"><div></code> are for blocks of content.
</p>
<h2>Add a Div</h2>
<p>Since we already have text about us on our <code>index.html</code>, we'll make it an about page. Later we can
add a profile image to this page. Let's group the image and the text in our about page together to distinguish
it from the heading and other content. No other tag <em>really</em> fits the semantic we want, so we will use a
<code class="language-html"><div></code>.
</p>
<p>Let's add a <code class="language-html"><div></code> to your personal website. In your
<code>index.html</code> file, let's wrap all of your paragraphs in a <code
class="language-html"><div></code>. Let's give this <code class="language-html"><div></code> the
class attribute of <code class="language-html"><div class="about-text"></code>.
</p>
<p>Let's also add a blank <code class="language-html"><div></code> with the class attribute <code
class="language-html">class="about-image"</code> as a placeholder for our future image above your text <code
class="language-html"><div></code>.</p>
<p>Finally, let's wrap both the image <code class="language-html"><div></code> and the text <code
class="language-html"><div></code> in a <code class="language-html"><div class="about"></code>!
</p>
<p>It'll look something like the following:</p>
<h3 class="file-heading"><em>index.html</em></h3>
<pre class="file line-numbers" data-src="prism/html/2001.html" data-line="10-12,27-28"></pre>
<p class="note"><strong>Note:</strong> The heading on Line 9 stays outside the <code
class="language-html"><div></code>. Don't forget the class attribute and attribute value for each one!
</p>
</div>
</main>
<script src="js/ui.js" type="text/javascript"></script>
<script src="js/prism.js" type="text/javascript"></script>
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
mermaid.initialize({startOnLoad: true, theme: "base"});
</script>
</body>
</html>