Skip to content

Commit 7446675

Browse files
committed
Ch. 37 Centering Our Page
1 parent 6a0f215 commit 7446675

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

starter/03-CSS-Fundamentals/notes/index.html

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,13 @@ <h3 class="chapter-sub-section-heading">Global Reset</h3>
210210
of this styling is to override it using the universal selector:
211211
</p>
212212

213-
<code><pre>* {
213+
<code>
214+
<pre>
215+
* {
214216
margin: 0;
215217
padding: 0;
216-
}</pre>
218+
}
219+
</pre>
217220
</code>
218221

219222
<p>
@@ -243,5 +246,35 @@ <h3 class="chapter-sub-section-heading">New Properties:</h3>
243246
</ul>
244247
</article>
245248
</article>
249+
250+
<article class="chapter">
251+
<h2 class="chapter-heading">Ch. 37 Centering Our Page</h2>
252+
<p>
253+
A simple way to center the page would be to place the entire page's body into
254+
a container, then set that container's width to a constant value and set the
255+
left and right margin to auto:
256+
</p>
257+
258+
<code>
259+
<pre>
260+
&lt;head&gt;
261+
...
262+
&lt;style&gt;
263+
.container {
264+
width: 800px;
265+
margin: 0 auto;
266+
}
267+
&lt;/style&gt;
268+
&lt;/head&gt;
269+
&lt;body&gt;
270+
&lt;div class="container"&gt;. . .&lt;/div&gt;
271+
&lt;/body&gt;
272+
</pre>
273+
</code>
274+
275+
<p>
276+
There is no specific element that semantically represents this container, so <code>&lt;div&gt;</code> is fine
277+
</p>
278+
</article>
246279
</body>
247280
</html>

0 commit comments

Comments
 (0)