Skip to content

Commit 67a5f15

Browse files
committed
section-4: Style inner components with flexbox.
1 parent 99121e3 commit 67a5f15

File tree

2 files changed

+66
-16
lines changed

2 files changed

+66
-16
lines changed

starter/04-CSS-Layouts/index.html

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,19 @@ <h1>📘 The Code Magazine</h1>
3636
<header class="post-header">
3737
<h2>The Basic Language of the Web: HTML</h2>
3838

39-
<img
39+
<div class="author-box">
40+
<img
4041
src="img/laura-jones.jpg"
4142
alt="Headshot of Laura Jones"
4243
class="author-image"
4344
height="50"
4445
width="50"
45-
/>
46+
/>
4647

47-
<p id="author" class="author">
48-
Posted by <strong>Laura Jones</strong> on Monday, June 21st 2027
49-
</p>
48+
<p id="author" class="author">
49+
Posted by <strong>Laura Jones</strong> on Monday, June 21st 2027
50+
</p>
51+
</div>
5052

5153
<img
5254
src="img/post-img.jpg"
@@ -126,35 +128,41 @@ <h3>Why should you learn HTML?</h3>
126128
<h4>Related posts</h4>
127129

128130
<ul class="related">
129-
<li>
131+
<li class="related-post">
130132
<img
131133
src="img/related-1.jpg"
132134
alt="Person programming"
133135
width="75"
134136
height="75"
135137
/>
136-
<a href="#">How to Learn Web Development</a>
137-
<p class="related-author">By Jonas Schmedtmann</p>
138+
<div>
139+
<a href="#" class="related-link">How to Learn Web Development</a>
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: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ nav a:link {
197197
display: block; */
198198

199199
margin-right: 30px;
200-
margin-top: 10px;
201200
display: inline-block;
202201
}
203202

@@ -266,7 +265,9 @@ nav p {
266265
font-size: 18px;
267266
} */
268267

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

0 commit comments

Comments
 (0)