-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlab_036.html
94 lines (89 loc) · 4.53 KB
/
lab_036.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
<!doctype html>
<html lang="en">
<head>
<title>
Lab 36 - Shorthand Properties
</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="36">
<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 36</em>
Shorthand Properties
</h1>
<h2>Goals</h2>
<ul>
<li>Learn the shorthand for specific CSS properties</li>
</ul>
<h2>Margins and Padding</h2>
<p>Both margins and padding have a shorthand that amalgamates multiple properties into one property. This
shorthand property takes a space-separated string of values instead of just one.</p>
<p>The four margin properties, <code class="language-css">margin-top</code>, <code
class="language-css">margin-right</code>, <code class="language-css">margin-bottom</code>, and <code
class="language-css">margin-left</code> can all be condensed into the <code class="language-css">margin</code>
property. The order of the <code class="language-css">margin</code> property values is <code
class="language-css">margin: top right bottom left</code>. The following definition shows this:</p>
<pre data-range="1,10" data-src="prism/css/3601.css"></pre>
<p class="note"><strong>Note:</strong> If you only put two values instead of four, <code
class="language-css">margin: 5px 10px</code>, the first will be used for both top <em>and</em> bottom
and the second for left <em>and</em> right.</p>
<p>The same format of shorthand works for combining <code class="language-css">padding-top</code>, <code
class="language-css">padding-right</code>, <code class="language-css">padding-bottom</code>, and <code
class="language-css">padding-left</code> into <code class="language-css">padding</code>.
</p>
<h2>Borders</h2>
<p><code class="language-css">border-width</code>, <code class="language-css">border-style</code>, and <code
class="language-css">border-color</code> can all be combined into one <code class="language-css">border</code>
property. This shorthand combination can also be applied to specific border edges i.e. <code
class="language-css">border-top</code>, <code class="language-css">border-right</code>, <code
class="language-css">border-bottom</code>, and <code class="language-css">border-left</code>.</p>
<p>Here's a few examples of the shorthand:</p>
<pre data-range="12,25" data-src="prism/css/3601.css"></pre>
<h2>More CSS</h2>
<p>Use the <code class="language-css">margin</code>, <code class="language-css">padding</code>, and <code
class="language-css">border</code>
properties to add some style to your website. Put space between elements or set them up to be properly laid out
in the next lab.</p>
<p>There are a lot of different properties we haven't covered that you could attempt to add to your page.
For example: <code class="language-css">border-radius</code>, <code class="language-css">box-shadow</code>, or
<code class="language-css">text-shadow</code>.
Take some time to explore them here: <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Reference"
target="_blank" rel="noopener">https://developer.mozilla.org/en-US/docs/Web/CSS/Reference</a>
</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>