Skip to content

Commit a713ee0

Browse files
committed
styling flexbox
1 parent 377ec8d commit a713ee0

File tree

3 files changed

+67
-24
lines changed

3 files changed

+67
-24
lines changed

projectfolder/css/style.css

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
body {
99
border-top: 5px solid #1098ad;
1010
color: #444;
11-
font-family: sans-serif;
11+
font-family: poppins;
1212
position: relative;
1313
}
1414

@@ -176,7 +176,6 @@ nav a:link {
176176
padding: 20px;
177177
display: block; */
178178
margin-right: 30px;
179-
margin-top: 10px;
180179
display: inline-block;
181180
}
182181

@@ -250,7 +249,7 @@ h2::after {
250249
right: -25px;
251250
}
252251

253-
/* Floats */
252+
/* Floats
254253
255254
.author-img {
256255
float: left;
@@ -291,4 +290,20 @@ aside {
291290
}
292291
footer {
293292
clear: both;
293+
} */
294+
295+
/* Flex box */
296+
.main-header {
297+
display: flex;
298+
align-items: center;
299+
justify-content: space-between;
300+
}
301+
302+
.author-box {
303+
display: flex;
304+
align-items: center;
305+
}
306+
.author {
307+
margin-bottom: 0px;
308+
margin-left: 15px;
294309
}

projectfolder/index.html

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,20 @@ <h1>📘 The Code Magazine</h1>
3636
<article>
3737
<header class="post-header">
3838
<h2>The Basic Langauge of The Web: HTML</h2>
39-
<img
40-
src="./imgs/laura-jones.jpg"
41-
alt="the person who wrote this"
42-
width="50"
43-
height="50"
44-
class="author-img"
45-
/>
46-
<p id="author" class="author">
47-
Posted by <strong>Laura Jones </strong> on Monday, June 21st 2027
48-
</p>
49-
<br />
39+
40+
<div class="author-box">
41+
<img
42+
src="./imgs/laura-jones.jpg"
43+
alt="the person who wrote this"
44+
width="50"
45+
height="50"
46+
class="author-img"
47+
/>
48+
<p id="author" class="author">
49+
Posted by <strong>Laura Jones </strong> on Monday, June 21st 2027
50+
</p>
51+
<br />
52+
</div>
5053

5154
<img
5255
class="post-img"
@@ -119,35 +122,35 @@ <h3>Why should you learn HTML</h3>
119122
<aside class="related-aside">
120123
<h4><strong>Related Posts</strong></h4>
121124
<ul class="related-list">
122-
<li>
125+
<li class="related-post">
123126
<img
124127
src="imgs/related-1.jpg"
125128
alt="How to Learn Web Development"
126129
height="50"
127130
width="50"
128131
/>
129-
<a href="#"> How to Learn Web Development</a>
132+
<a href="#" class="related-links"> How to Learn Web Development</a>
130133
<p class="related-author">By Jonas Schmeltmann</p>
131134
</li>
132135

133-
<li>
136+
<li clas="related-post">
134137
<img
135138
src="imgs/related-2.jpg"
136139
alt="Unknown Power of CSS"
137140
height="50"
138141
width="50"
139142
/>
140-
<a href="#"> The Uknown Power of CSS</a>
143+
<a href="#" class="related-links"> The Uknown Power of CSS</a>
141144
<p class="related-author">By Jonas Schmeltmann</p>
142145
</li>
143-
<li>
146+
<li class="related-post">
144147
<img
145148
src="imgs/related-3.jpg"
146149
alt="Why Javascript is Awsome"
147150
height="50"
148151
width="50"
149152
/>
150-
<a href="#"> Why Javascript is Awsome</a>
153+
<a href="#" class="related-links"> Why Javascript is Awsome</a>
151154
<p class="related-author">By Jonas Schmeltmann</p>
152155
</li>
153156
</ul>

projectfolder/pages/flexbox.html

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,34 @@
4141

4242
/* FLEXBOX */
4343
display: flex;
44-
align-items: stretch;
4544
align-items: center;
46-
justify-content: space-between;
45+
justify-content: flex-start;
46+
}
47+
.el {
48+
/* DEFAULTS
49+
50+
flex-grow: 0;
51+
flex-shrink: 1;
52+
flex-basis: auto;
53+
*/
54+
/* flex-basis: 200px; */
55+
/* flex-shrink: 0;
56+
/* flex-grow: 1; */
57+
/* flex: 0 0 200px; */
58+
flex: 1;
59+
}
60+
61+
.el--1 {
62+
align-self: flex-start;
63+
/* flex-grow: 1; */
64+
}
65+
66+
.el--5 {
67+
align-self: stretch;
68+
}
69+
70+
.el--6 {
71+
order: -1;
4772
}
4873
</style>
4974
</head>
@@ -54,9 +79,9 @@
5479
<div class="el el--3">CSS</div>
5580
<div class="el el--4">are</div>
5681
<div class="el el--5">amazing</div>
57-
<div class="el el--6">languages</div>
82+
<!-- <div class="el el--6">languages</div>
5883
<div class="el el--7">to</div>
59-
<div class="el el--8">learn</div>
84+
<div class="el el--8">learn</div> -->
6085
</div>
6186
</body>
6287
</html>

0 commit comments

Comments
 (0)