Skip to content

Commit beff4a1

Browse files
committed
Lecture on Floats
1 parent ae446ad commit beff4a1

File tree

2 files changed

+80
-7
lines changed

2 files changed

+80
-7
lines changed

starter/03-CSS-Fundamentals/index.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ <h6>The Basic Language of the Web: HTML</h6>
1818
-->
1919

2020
<div class="container">
21-
<header class="main-header">
21+
<header class="main-header clearfix">
2222
<h1>📘 The Code Magazine</h1>
2323

2424
<nav>
@@ -29,6 +29,8 @@ <h1>📘 The Code Magazine</h1>
2929
<a href="#">Flexbox</a>
3030
<a href="#">CSS Grid</a>
3131
</nav>
32+
33+
<!-- <div class="clear"></div> -->
3234
</header>
3335

3436
<article>
@@ -40,9 +42,10 @@ <h2>The Basic Language of the Web: HTML</h2>
4042
alt="Headshot of Laura Jones"
4143
height="50"
4244
width="50"
45+
class="author-img"
4346
/>
4447

45-
<p id="author">
48+
<p id="author" class="author">
4649
Posted by <strong>Laura Jones</strong> on Monday, June 21st 2027
4750
</p>
4851

starter/03-CSS-Fundamentals/style.css

Lines changed: 75 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/* border-top: 10px solid #1098ad; */
33
margin: 0;
44
padding: 0;
5+
box-sizing: border-box;
56
}
67

78
/* PAGE SECTIONS */
@@ -14,7 +15,7 @@ body {
1415
}
1516

1617
.container {
17-
width: 800px;
18+
width: 1200px;
1819
/* margin-left: auto;
1920
margin-right: auto; */
2021
margin: 0 auto; /* Centers the container */
@@ -25,7 +26,7 @@ body {
2526
background-color: #f7f7f7;
2627
padding: 20px 40px;
2728
margin-bottom: 60px;
28-
height: 80px;
29+
/* height: 80px; */
2930
}
3031

3132
article {
@@ -34,7 +35,7 @@ article {
3435

3536
nav {
3637
font-size: 18px;
37-
text-align: center;
38+
/* text-align: center; */
3839
}
3940

4041
.post-header {
@@ -48,8 +49,7 @@ aside {
4849
border-bottom: 5px solid #1098ad;
4950
/* padding-top: 50px;
5051
padding-bottom: 50px; */
51-
padding: 50px 0;
52-
width: 500px;
52+
padding: 50px 40px;
5353
}
5454

5555
/* SMALLER SECTIONS */
@@ -68,6 +68,7 @@ h1 {
6868

6969
h2 {
7070
font-size: 40px;
71+
margin-bottom: 30px;
7172
}
7273

7374
h3 {
@@ -80,6 +81,7 @@ h4 {
8081
font-size: 20px;
8182
text-transform: uppercase;
8283
text-align: center;
84+
margin-bottom: 30px;
8385
}
8486

8587
p {
@@ -127,6 +129,7 @@ li:last-child {
127129

128130
.related {
129131
list-style: none;
132+
margin-left: 0;
130133
}
131134

132135
/* .first-li {
@@ -335,3 +338,70 @@ position: absolute
335338
*/
336339

337340
/* Stopped at Developer Skill #1: Googling and Reading Documentation */
341+
342+
/* CSS Layouts will still be done here */
343+
344+
/* FLOATS */
345+
/*
346+
347+
** Floats are different from absolute positioning
348+
349+
- Element is removed from the normal flow: "out of flow"
350+
- Text and inline elements will wrap around the floated element
351+
- The container will not adjust its height to the element *collapsing element or collapsed height
352+
353+
float: left;
354+
float: right;
355+
356+
*/
357+
.author-img {
358+
float: left;
359+
margin-bottom: 20px;
360+
}
361+
362+
.author {
363+
float: left;
364+
margin-top: 10px;
365+
margin-left: 20px;
366+
}
367+
368+
h1 {
369+
float: left;
370+
}
371+
372+
nav {
373+
float: right;
374+
}
375+
376+
.clear {
377+
clear: both;
378+
}
379+
380+
.clearfix::after {
381+
clear: both;
382+
content: "";
383+
display: block;
384+
}
385+
386+
article {
387+
width: 825px;
388+
float: left;
389+
}
390+
391+
aside {
392+
width: 300px;
393+
float: right;
394+
}
395+
396+
footer {
397+
clear: both;
398+
}
399+
400+
/* THE BOX MODEL WITH BOX-SIZING: BORDER BOX */
401+
/*
402+
403+
box-sizing: border-box;
404+
405+
*/
406+
407+
/* Stopped at Challenge #1: CSS Layouts */

0 commit comments

Comments
 (0)