Skip to content

Commit 91d46d5

Browse files
author
Ronan
committed
Add flexbox to blog post
1 parent 24780c8 commit 91d46d5

File tree

2 files changed

+73
-23
lines changed

2 files changed

+73
-23
lines changed

starter/04-CSS-Layouts/index.html

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,18 @@ <h1>📘 The Code Magazine</h1>
3434
<header class="post-header">
3535
<h2>The Basic Language of the Web: HTML</h2>
3636

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

4950
<img
5051
src="img/post-img.jpg"
@@ -124,35 +125,41 @@ <h3>Why should you learn HTML?</h3>
124125
<h4>Related posts</h4>
125126

126127
<ul class="related">
127-
<li>
128+
<li class="related-post">
128129
<img
129130
src="img/related-1.jpg"
130131
alt="Person programming"
131132
width="75"
132133
height="75"
133134
/>
134-
<a href="#">How to Learn Web Development</a>
135-
<p class="related-author">By Jonas Schmedtmann</p>
135+
<div>
136+
<a href="#" class="related-link">How to Learn Web Development</a>
137+
<p class="related-author">By Jonas Schmedtmann</p>
138+
</div>
136139
</li>
137-
<li>
140+
<li class="related-post">
138141
<img
139142
src="img/related-2.jpg"
140143
alt="Lightning"
141144
width="75"
142145
height="75"
143146
/>
144-
<a href="#">The Unknown Powers of CSS</a>
145-
<p class="related-author">By Jim Dillon</p>
147+
<div>
148+
<a href="#" class="related-link">The Unknown Powers of CSS</a>
149+
<p class="related-author">By Jim Dillon</p>
150+
</div>
146151
</li>
147-
<li>
152+
<li class="related-post">
148153
<img
149154
src="img/related-3.jpg"
150155
alt="JavaScript code on a screen"
151156
width="75"
152157
height="75"
153158
/>
154-
<a href="#">Why JavaScript is Awesome</a>
155-
<p class="related-author">By Matilda</p>
159+
<div>
160+
<a href="#" class="related-link">Why JavaScript is Awesome</a>
161+
<p class="related-author">By Matilda</p>
162+
</div>
156163
</li>
157164
</ul>
158165
</aside>

starter/04-CSS-Layouts/style.css

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ body {
2222
}
2323

2424
.main-header {
25-
background-color:#f7f7f7;
25+
background-color: #f7f7f7;
2626
/* padding: 20px;
2727
padding-left: 40px;
2828
padding-right: 40px; */
@@ -197,7 +197,7 @@ nav a:link {
197197
display: block; */
198198

199199
margin-right: 30px;
200-
margin-top: 10px;
200+
/* margin-top: 10px; */
201201
display: inline-block;
202202
}
203203

@@ -267,6 +267,7 @@ nav p {
267267
} */
268268

269269
/* FLOATS */
270+
/*
270271
.author-img {
271272
float: left;
272273
margin-bottom: 20px;
@@ -308,4 +309,46 @@ aside {
308309
309310
footer {
310311
clear: both;
311-
}
312+
}
313+
*/
314+
315+
/* FLEXBOX */
316+
317+
.main-header {
318+
display: flex;
319+
align-items: center;
320+
justify-content: space-between;
321+
}
322+
323+
.author-box {
324+
display: flex;
325+
align-items: center;
326+
margin-bottom: 15px;
327+
}
328+
329+
.author {
330+
margin-bottom: 0;
331+
margin-left: 15px;
332+
}
333+
334+
.related-post {
335+
display: flex;
336+
align-items: center;
337+
gap: 20px;
338+
margin-bottom: 30px;
339+
}
340+
341+
.related-link {
342+
font-size: 17px;
343+
font-weight: bold;
344+
font-style: normal;
345+
display: block;
346+
margin-bottom: 5px;
347+
}
348+
349+
.related-author {
350+
margin-bottom: 0;
351+
font-size: 14px;
352+
font-weight: normal;
353+
font-style: italic;
354+
}

0 commit comments

Comments
 (0)