-
Notifications
You must be signed in to change notification settings - Fork 0
/
lab_032.html
83 lines (75 loc) · 2.97 KB
/
lab_032.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
<!doctype html>
<html lang="en">
<head>
<title>
Lab 32 - Grouping and Nesting
</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="32">
<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 32</em>
Grouping and Nesting
</h1>
<h2>Goals</h2>
<ul>
<li>Learn about grouping and nesting selectors in CSS</li>
</ul>
<h2>Grouping</h2>
<p>You can group multiple selectors in order to give them all the same styling. Separate selectors by
<strong>commas</strong> before the curly brackets in order to group them.
</p>
<p>For example:</p>
<pre data-range="1, 11" data-src="prism/css/3201.css"></pre>
<p>Can be grouped into the following:</p>
<pre data-range="13, 17" data-src="prism/css/3201.css"></pre>
<h2>Nesting</h2>
<p>If you have well structured and semantic HTML, you can make use of CSS nesting in order to cut
down on the amount of class attributes. Separating two selectors with a <strong>space</strong> will select all
the descendents
of the first selector that <em>is</em> the second selector.</p>
<pre data-range="19, 29" data-src="prism/css/3201.css"></pre>
<p>If the HTML was:</p>
<pre class="line-numbers" data-range="8,12" data-src="prism/html/3201.html"></pre>
<p>You would be able to select the heading and paragraphs with the nested CSS instead of a class or ID attribute.
Separating the two selectors is the same as saying "<code class="language-html"><h1></code> inside of an
element with <code>id="special"</code>" or "<code class="language-html"><p></code> inside of an element
with <code>id="special"</code>".
</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>