Skip to content

Commit 7dd9eb4

Browse files
committed
feat: adding flexbox to our project.
1 parent 10e17c4 commit 7dd9eb4

File tree

2 files changed

+77
-30
lines changed

2 files changed

+77
-30
lines changed

starter/04-CSS-Layouts/index.html

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,19 @@ <h1>📘 The Code Magazine</h1>
3535
<article>
3636
<header class="post-header">
3737
<h2>The Basic Language of the Web: HTML</h2>
38+
<div class="author-box">
39+
<img
40+
src="img/laura-jones.jpg"
41+
alt="Headshot of Laura Jones"
42+
height="50"
43+
width="50"
44+
class="author-img"
45+
/>
3846

39-
<img
40-
src="img/laura-jones.jpg"
41-
alt="Headshot of Laura Jones"
42-
height="50"
43-
width="50"
44-
class="author-img"
45-
/>
46-
47-
<p id="author" class="author">
48-
Posted by <strong>Laura Jones</strong> on Monday, June 21st 2027
49-
</p>
47+
<p id="author" class="author">
48+
Posted by <strong>Laura Jones</strong> on Monday, June 21st 2027
49+
</p>
50+
</div>
5051

5152
<img
5253
src="img/post-img.jpg"
@@ -126,35 +127,42 @@ <h3>Why should you learn HTML?</h3>
126127
<h4>Related posts</h4>
127128

128129
<ul class="related">
129-
<li>
130+
<li class="related-post">
130131
<img
131132
src="img/related-1.jpg"
132133
alt="Person programming"
133134
width="75"
134135
height="75"
135136
/>
136-
<a href="#">How to Learn Web Development</a>
137-
<p class="related-author">By Jonas Schmedtmann</p>
137+
<div>
138+
<a href="#" class="related-link">How to Learn Web Development</a>
139+
140+
<p class="related-author">By Jonas Schmedtmann</p>
141+
</div>
138142
</li>
139-
<li>
143+
<li class="related-post">
140144
<img
141145
src="img/related-2.jpg"
142146
alt="Lightning"
143147
width="75"
144148
height="75"
145149
/>
146-
<a href="#">The Unknown Powers of CSS</a>
147-
<p class="related-author">By Jim Dillon</p>
150+
<div>
151+
<a href="#" class="related-link">The Unknown Powers of CSS</a>
152+
<p class="related-author">By Jim Dillon</p>
153+
</div>
148154
</li>
149-
<li>
155+
<li class="related-post">
150156
<img
151157
src="img/related-3.jpg"
152158
alt="JavaScript code on a screen"
153159
width="75"
154160
height="75"
155161
/>
156-
<a href="#">Why JavaScript is Awesome</a>
157-
<p class="related-author">By Matilda</p>
162+
<div>
163+
<a href="#" class="related-link">Why JavaScript is Awesome</a>
164+
<p class="related-author">By Matilda</p>
165+
</div>
158166
</li>
159167
</ul>
160168
</aside>

starter/04-CSS-Layouts/style.css

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ nav a:link {
200200
display: block; */
201201

202202
margin-right: 30px;
203-
margin-top: 10px;
203+
/* margin-top: 10px; */
204204
display: inline-block;
205205
}
206206

@@ -269,13 +269,13 @@ nav p {
269269
font-size: 18px;
270270
} */
271271

272+
/* * Float
272273
.author-img {
273274
float: left;
274275
margin-bottom: 20px;
275276
}
276277
277278
.author {
278-
/* padding-left: 80px; */
279279
margin-top: 10px;
280280
margin-left: 20px;
281281
float: left;
@@ -289,34 +289,73 @@ nav {
289289
float: right;
290290
}
291291
292-
/* Remem */
293-
/* * Old way to clearing float problem */
292+
Old way to clearing float problem
294293
.clear {
295294
clear: both;
296295
}
297296
298-
/* * New way to clearing float problem: clearfix hacked */
297+
New way to clearing float problem: clearfix hacked
299298
.clearfix::after {
300299
clear: both;
301300
content: "";
302301
display: block;
303302
}
304303
305-
/* * !!! Remember that 'float' is an old way to layout website */
304+
!!! Remember that 'float' is an old way to layout website
306305
307306
article {
308-
/* background-color: green; */
309307
width: 825px;
310308
float: left;
311309
}
312310
313311
aside {
314-
/* background-color: red; */
315312
width: 300px;
316313
float: right;
317314
}
318315
319316
footer {
320-
/* background-color: yellow; */
321-
clear: both; /* * Clear the float: return to normal-flow */
317+
clear: both;
318+
Clear the float: return to normal-flow
319+
}
320+
321+
*/
322+
323+
/* * Flex */
324+
.main-header {
325+
display: flex;
326+
align-items: center;
327+
justify-content: space-between;
328+
}
329+
330+
.author-box {
331+
display: flex;
332+
align-items: center;
333+
margin-bottom: 15px;
334+
}
335+
336+
.author {
337+
margin-bottom: 0;
338+
margin-left: 15px;
339+
}
340+
341+
.related-post {
342+
display: flex;
343+
align-items: center;
344+
gap: 20px;
345+
margin-bottom: 30px;
346+
}
347+
348+
.related-link:link {
349+
font-size: 17px;
350+
font-weight: bold;
351+
font-style: normal;
352+
margin-bottom: 5px;
353+
display: block;
354+
}
355+
356+
.related-author {
357+
margin-bottom: 0;
358+
font-size: 14px;
359+
font-weight: normal;
360+
font-style: italic;
322361
}

0 commit comments

Comments
 (0)