Skip to content

Commit 53b4f55

Browse files
committed
Build a simple CSS Grid Layout.
1 parent 0077e53 commit 53b4f55

File tree

2 files changed

+163
-140
lines changed

2 files changed

+163
-140
lines changed

starter/04-CSS-Layouts/index.html

Lines changed: 133 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -30,143 +30,142 @@ <h1>📘 The Code Magazine</h1>
3030
</nav>
3131
<!-- <div class="clear"></div> -->
3232
</header>
33-
<div class="row">
34-
<article>
35-
<header class="post-header">
36-
<h2>The Basic Language of the Web: HTML</h2>
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-
46-
<p id="author" class="author">
47-
Posted by <strong>Laura Jones</strong> on Monday, June 21st 2027
48-
</p>
49-
</div>
33+
<!-- ONLY NECESSARY FOR FLEXBOX -->
34+
<!-- <div class="row"> -->
35+
<article>
36+
<header class="post-header">
37+
<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+
/>
46+
47+
<p id="author" class="author">
48+
Posted by <strong>Laura Jones</strong> on Monday, June 21st 2027
49+
</p>
50+
</div>
51+
52+
<img
53+
src="img/post-img.jpg"
54+
alt="HTML code on a screen"
55+
width="500"
56+
height="200"
57+
class="post-img"
58+
/>
59+
<button>❤️ Like</button>
60+
</header>
61+
62+
<p>
63+
All modern websites and web applications are built using three
64+
<em>fundamental</em>
65+
technologies: HTML, CSS and JavaScript. These are the languages of the
66+
web.
67+
</p>
68+
69+
<p>
70+
In this post, let's focus on HTML. We will learn what HTML is all
71+
about, and why you too should learn it.
72+
</p>
73+
74+
<h3>What is HTML?</h3>
75+
<p>
76+
HTML stands for <strong>H</strong>yper<strong>T</strong>ext
77+
<strong>M</strong>arkup <strong>L</strong>anguage. It's a markup
78+
language that web developers use to structure and describe the content
79+
of a webpage (not a programming language).
80+
</p>
81+
<p>
82+
HTML consists of elements that describe different types of content:
83+
paragraphs, links, headings, images, video, etc. Web browsers
84+
understand HTML and render HTML code as websites.
85+
</p>
86+
<p>In HTML, each element is made up of 3 parts:</p>
87+
88+
<ol>
89+
<li class="first-li">The opening tag</li>
90+
<li>The closing tag</li>
91+
<li>The actual element</li>
92+
</ol>
93+
94+
<p>
95+
You can learn more at
96+
<a
97+
href="https://developer.mozilla.org/en-US/docs/Web/HTML"
98+
target="_blank"
99+
>MDN Web Docs</a
100+
>.
101+
</p>
50102

103+
<h3>Why should you learn HTML?</h3>
104+
105+
<p>
106+
There are countless reasons for learning the fundamental language of
107+
the web. Here are 5 of them:
108+
</p>
109+
110+
<ul>
111+
<li class="first-li">
112+
To be able to use the fundamental web dev language
113+
</li>
114+
<li>
115+
To hand-craft beautiful websites instead of relying on tools like
116+
Worpress or Wix
117+
</li>
118+
<li>To build web applications</li>
119+
<li>To impress friends</li>
120+
<li>To have fun 😃</li>
121+
</ul>
122+
123+
<p>Hopefully you learned something new here. See you next time!</p>
124+
</article>
125+
126+
<aside>
127+
<h4>Related posts</h4>
128+
129+
<ul class="related">
130+
<li class="related-post">
131+
<img
132+
src="img/related-1.jpg"
133+
alt="Person programming"
134+
width="75"
135+
height="75"
136+
/>
137+
<div>
138+
<a href="#" class="related-link">How to Learn Web Development</a>
139+
<p class="related-author">By Jonas Schmedtmann</p>
140+
</div>
141+
</li>
142+
<li class="related-post">
51143
<img
52-
src="img/post-img.jpg"
53-
alt="HTML code on a screen"
54-
width="500"
55-
height="200"
56-
class="post-img"
144+
src="img/related-2.jpg"
145+
alt="Lightning"
146+
width="75"
147+
height="75"
57148
/>
58-
<button>❤️ Like</button>
59-
</header>
60-
61-
<p>
62-
All modern websites and web applications are built using three
63-
<em>fundamental</em>
64-
technologies: HTML, CSS and JavaScript. These are the languages of
65-
the web.
66-
</p>
67-
68-
<p>
69-
In this post, let's focus on HTML. We will learn what HTML is all
70-
about, and why you too should learn it.
71-
</p>
72-
73-
<h3>What is HTML?</h3>
74-
<p>
75-
HTML stands for <strong>H</strong>yper<strong>T</strong>ext
76-
<strong>M</strong>arkup <strong>L</strong>anguage. It's a markup
77-
language that web developers use to structure and describe the
78-
content of a webpage (not a programming language).
79-
</p>
80-
<p>
81-
HTML consists of elements that describe different types of content:
82-
paragraphs, links, headings, images, video, etc. Web browsers
83-
understand HTML and render HTML code as websites.
84-
</p>
85-
<p>In HTML, each element is made up of 3 parts:</p>
86-
87-
<ol>
88-
<li class="first-li">The opening tag</li>
89-
<li>The closing tag</li>
90-
<li>The actual element</li>
91-
</ol>
92-
93-
<p>
94-
You can learn more at
95-
<a
96-
href="https://developer.mozilla.org/en-US/docs/Web/HTML"
97-
target="_blank"
98-
>MDN Web Docs</a
99-
>.
100-
</p>
101-
102-
<h3>Why should you learn HTML?</h3>
103-
104-
<p>
105-
There are countless reasons for learning the fundamental language of
106-
the web. Here are 5 of them:
107-
</p>
108-
109-
<ul>
110-
<li class="first-li">
111-
To be able to use the fundamental web dev language
112-
</li>
113-
<li>
114-
To hand-craft beautiful websites instead of relying on tools like
115-
Worpress or Wix
116-
</li>
117-
<li>To build web applications</li>
118-
<li>To impress friends</li>
119-
<li>To have fun 😃</li>
120-
</ul>
121-
122-
<p>Hopefully you learned something new here. See you next time!</p>
123-
</article>
124-
125-
<aside>
126-
<h4>Related posts</h4>
127-
128-
<ul class="related">
129-
<li class="related-post">
130-
<img
131-
src="img/related-1.jpg"
132-
alt="Person programming"
133-
width="75"
134-
height="75"
135-
/>
136-
<div>
137-
<a href="#" class="related-link"
138-
>How to Learn Web Development</a
139-
>
140-
<p class="related-author">By Jonas Schmedtmann</p>
141-
</div>
142-
</li>
143-
<li class="related-post">
144-
<img
145-
src="img/related-2.jpg"
146-
alt="Lightning"
147-
width="75"
148-
height="75"
149-
/>
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>
154-
</li>
155-
<li class="related-post">
156-
<img
157-
src="img/related-3.jpg"
158-
alt="JavaScript code on a screen"
159-
width="75"
160-
height="75"
161-
/>
162-
<div>
163-
<a href="#" class="related-link">Why JavaScript is Awesome</a>
164-
<p class="related-author">By Matilda</p>
165-
</div>
166-
</li>
167-
</ul>
168-
</aside>
169-
</div>
149+
<div>
150+
<a href="#" class="related-link">The Unknown Powers of CSS</a>
151+
<p class="related-author">By Jim Dillon</p>
152+
</div>
153+
</li>
154+
<li class="related-post">
155+
<img
156+
src="img/related-3.jpg"
157+
alt="JavaScript code on a screen"
158+
width="75"
159+
height="75"
160+
/>
161+
<div>
162+
<a href="#" class="related-link">Why JavaScript is Awesome</a>
163+
<p class="related-author">By Matilda</p>
164+
</div>
165+
</li>
166+
</ul>
167+
</aside>
168+
<!-- </div> -->
170169

171170
<footer>
172171
<p id="copyright" class="copyright text">

starter/04-CSS-Layouts/style.css

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ body {
2727
padding-left: 40px;
2828
padding-right: 40px; */
2929
padding: 20px 40px;
30-
margin-bottom: 60px;
30+
/* margin-bottom: 60px; */
3131
/* height: 80px; */
3232
}
3333

@@ -37,7 +37,7 @@ nav {
3737
}
3838

3939
article {
40-
margin-bottom: 60px;
40+
/* margin-bottom: 60px; */
4141
}
4242

4343
.post-header {
@@ -349,8 +349,8 @@ footer {
349349
font-weight: normal;
350350
font-style: italic;
351351
}
352-
353-
.row {
352+
/* FLEXBOX LAYOUT */
353+
/* .row {
354354
display: flex;
355355
align-items: flex-start;
356356
gap: 75px;
@@ -362,9 +362,33 @@ article {
362362
margin-bottom: 0;
363363
}
364364
aside {
365-
/* DEFAULT
365+
DEFAULT
366366
flex-grow: 0;
367367
flex-shrink: 1;
368-
flex-basis: auto; */
368+
flex-basis: auto;
369369
flex: 0 0 300px;
370+
} */
371+
372+
/* CSS GRID LAYOUT */
373+
.container {
374+
display: grid;
375+
grid-template-columns: 1fr 300px;
376+
column-gap: 75px;
377+
row-gap: 60px;
378+
align-items: start;
379+
}
380+
381+
.main-header {
382+
/* grid-column: 1 / span 2; */
383+
grid-column: 1 / -1;
384+
}
385+
386+
article {
387+
}
388+
389+
aside {
390+
/* align-self: start; */
391+
}
392+
footer {
393+
grid-column: 1 / -1;
370394
}

0 commit comments

Comments
 (0)