Skip to content

Commit 2fb926a

Browse files
author
DDH
committed
Layout: Floats
1 parent 10de6bc commit 2fb926a

File tree

3 files changed

+92
-9
lines changed

3 files changed

+92
-9
lines changed

starter/04-CSS-Layouts/flexbox.html

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,42 @@
3636
/* STARTER */
3737
font-family: sans-serif;
3838
background-color: #ddd;
39-
font-size: 40px;
39+
font-size: 32px;
4040
margin: 40px;
4141

4242
/* FLEXBOX */
43+
display: flex;
44+
align-items: center;
45+
justify-content: flex-start;
46+
/* gap: 30px; */
47+
}
48+
49+
.el {
50+
/* margin-right: 30px; */
51+
52+
/*
53+
DEFAULTS:
54+
flex-grow: 0;
55+
flex-shrink: 1;
56+
flex-basis: auto;
57+
*/
58+
/* flex-basis: 200px; */
59+
flex-shrink: 0;
60+
flex-grow: 1;
61+
}
62+
63+
.el--1 {
64+
align-self: flex-start;
65+
flex-grow: 2;
66+
}
67+
68+
.el--5 {
69+
align-self: stretch;
70+
/* order: 1; */
71+
}
72+
73+
.el--6 {
74+
/* order: -1; */
4375
}
4476
</style>
4577
</head>
@@ -51,8 +83,8 @@
5183
<div class="el el--4">are</div>
5284
<div class="el el--5">amazing</div>
5385
<div class="el el--6">languages</div>
54-
<div class="el el--7">to</div>
55-
<div class="el el--8">learn</div>
86+
<!-- <div class="el el--7">to</div>
87+
<div class="el el--8">learn</div> -->
5688
</div>
5789
</body>
5890
</html>

starter/04-CSS-Layouts/index.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,33 @@ <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>
2525
<!-- <strong>This is the navigation</strong> -->
2626
<a href="blog.html">Blog</a>
2727
<a href="#">Challenges</a>
28-
<a href="#">Flexbox</a>
29-
<a href="#">CSS Grid</a>
28+
<a href="flexbox.html">Flexbox</a>
29+
<a href="css-grid.html">CSS Grid</a>
3030
</nav>
31+
32+
<!-- <div class="clear"></div> -->
3133
</header>
3234

3335
<article>
3436
<header class="post-header">
3537
<h2>The Basic Language of the Web: HTML</h2>
3638

3739
<img
40+
class="author-img"
3841
src="img/laura-jones.jpg"
3942
alt="Headshot of Laura Jones"
4043
height="50"
4144
width="50"
4245
/>
4346

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

starter/04-CSS-Layouts/style.css

Lines changed: 50 additions & 2 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;
@@ -50,7 +51,7 @@ aside {
5051
border-bottom: 5px solid #1098ad;
5152
/* padding-top: 50px;
5253
padding-bottom: 50px; */
53-
padding: 50px 0;
54+
padding: 50px 40px;
5455
width: 500px;
5556
}
5657

@@ -82,6 +83,7 @@ h4 {
8283
font-size: 20px;
8384
text-transform: uppercase;
8485
text-align: center;
86+
margin-bottom: 30px;
8587
}
8688

8789
p {
@@ -134,6 +136,7 @@ li:last-child {
134136

135137
.related {
136138
list-style: none;
139+
margin-left: 0;
137140
}
138141

139142
body {
@@ -265,3 +268,48 @@ footer p {
265268
nav p {
266269
font-size: 18px;
267270
} */
271+
272+
/* FLOATS */
273+
.author-img {
274+
float: left;
275+
margin-bottom: 20px;
276+
}
277+
278+
.author {
279+
/* padding-left: 80px; */
280+
float: left;
281+
margin-top: 10px;
282+
margin-left: 20px;
283+
}
284+
285+
h1 {
286+
float: left;
287+
}
288+
289+
nav {
290+
float: right;
291+
}
292+
293+
/* .clear {
294+
clear: both;
295+
} */
296+
/*
297+
.clearfix::after {
298+
clear: both;
299+
content: "";
300+
display: block;
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)