Skip to content

Commit 4edbc21

Browse files
Section #4 - Float
1 parent 3bb55e3 commit 4edbc21

File tree

2 files changed

+64
-10
lines changed

2 files changed

+64
-10
lines changed

starter/04-CSS-Layouts/index.html

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

2020
<div class="container">
21-
<header class="main-header">
21+
<!--Agregamos otra clase "clearfix" -->
22+
<header class="main-header clearfix">
2223
<h1>📘 The Code Magazine</h1>
2324

2425
<nav>
@@ -28,6 +29,10 @@ <h1>📘 The Code Magazine</h1>
2829
<a href="#">Flexbox</a>
2930
<a href="#">CSS Grid</a>
3031
</nav>
32+
33+
<!--Creamos este div para limpiar floats - No es buena práctica-->
34+
35+
<!-- <div class="clear"></div> -->
3136
</header>
3237

3338
<article>
@@ -39,9 +44,10 @@ <h2>The Basic Language of the Web: HTML</h2>
3944
alt="Headshot of Laura Jones"
4045
height="50"
4146
width="50"
47+
class="author-img"
4248
/>
4349

44-
<p id="author">
50+
<p id="author" class="author">
4551
Posted by <strong>Laura Jones</strong> on Monday, June 21st 2027
4652
</p>
4753

starter/04-CSS-Layouts/style.css

Lines changed: 56 additions & 8 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;
@@ -48,10 +49,7 @@ aside {
4849
background-color: #f7f7f7;
4950
border-top: 5px solid #1098ad;
5051
border-bottom: 5px solid #1098ad;
51-
/* padding-top: 50px;
52-
padding-bottom: 50px; */
53-
padding: 50px 0;
54-
width: 500px;
52+
padding: 50px 40px;
5553
}
5654

5755
/* SMALLER ELEMENTS */
@@ -82,6 +80,7 @@ h4 {
8280
font-size: 20px;
8381
text-transform: uppercase;
8482
text-align: center;
83+
margin-bottom: 30px;
8584
}
8685

8786
p {
@@ -134,11 +133,12 @@ li:last-child {
134133

135134
.related {
136135
list-style: none;
136+
margin-left: 0;
137137
}
138138

139-
body {
140-
/* background-color: orangered; */
141-
}
139+
/* body {
140+
background-color: orangered;
141+
} */
142142

143143
/* .first-li {
144144
font-weight: bold;
@@ -265,3 +265,51 @@ footer p {
265265
nav p {
266266
font-size: 18px;
267267
} */
268+
269+
/* FLOATS */
270+
271+
.author-img {
272+
float: left;
273+
margin-bottom: 20px;
274+
}
275+
276+
.author {
277+
/* padding-left: 80px; */
278+
float: left;
279+
margin-top: 10px;
280+
margin-left: 20px;
281+
}
282+
283+
h1 {
284+
float: left;
285+
}
286+
287+
nav {
288+
float: right;
289+
}
290+
291+
.clear {
292+
clear: both;
293+
}
294+
295+
/* Clearfix method - psedo elements after and before are inline elements*/
296+
297+
.clearfix::after {
298+
content: "";
299+
display: block;
300+
clear: both;
301+
}
302+
303+
article {
304+
width: 825px;
305+
float: left;
306+
}
307+
308+
aside {
309+
width: 300px;
310+
float: right;
311+
}
312+
313+
footer {
314+
clear: both;
315+
}

0 commit comments

Comments
 (0)