0 added
0 removed
Original
2026-01-01
Modified
2026-03-09
1
<p><b>Loading…</b>Everything will be ready in few seconds</p>
1
<p><b>Loading…</b>Everything will be ready in few seconds</p>
2
<ul><li>Theory</li>
2
<ul><li>Theory</li>
3
<li>Theory</li>
3
<li>Theory</li>
4
<li>Comments</li>
4
<li>Comments</li>
5
</ul><h2>Perfect centering, flex alignment</h2>
5
</ul><h2>Perfect centering, flex alignment</h2>
6
<p>Now let’s center the items using the flex container properties without margin: auto in the child elements.</p>
6
<p>Now let’s center the items using the flex container properties without margin: auto in the child elements.</p>
7
<p>Notice how items are distributed differently depending on the various values of the justify-content property.</p>
7
<p>Notice how items are distributed differently depending on the various values of the justify-content property.</p>
8
<h2>Comments</h2>
8
<h2>Comments</h2>
9
<ul><li>index.html</li>
9
<ul><li>index.html</li>
10
<li>style.css</li>
10
<li>style.css</li>
11
</ul><p>HTML</p>
11
</ul><p>HTML</p>
12
<p><!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Perfect centering, flex alignment</title> <link href="course.css" rel="stylesheet"> <link href="style.css" rel="stylesheet"> </head> <body class="subtle"> <article class="item"> <h1>“Wolverine” Scratching Post</h1> <div class="pictures"> <div class="picture"> <img src="img/toy.png" alt=""> </div> <div class="picture"> <img src="img/toy.png" alt=""> </div> </div> <div class="controls"> <a href="/">Buy</a> </div> </article> </body> </html></p>
12
<p><!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Perfect centering, flex alignment</title> <link href="course.css" rel="stylesheet"> <link href="style.css" rel="stylesheet"> </head> <body class="subtle"> <article class="item"> <h1>“Wolverine” Scratching Post</h1> <div class="pictures"> <div class="picture"> <img src="img/toy.png" alt=""> </div> <div class="picture"> <img src="img/toy.png" alt=""> </div> </div> <div class="controls"> <a href="/">Buy</a> </div> </article> </body> </html></p>
13
<p>CSS</p>
13
<p>CSS</p>
14
<p>.pictures { display: flex; } .picture { margin: auto; }</p>
14
<p>.pictures { display: flex; } .picture { margin: auto; }</p>
15
<p>Thanks! We’ll fix everything at once!</p>
15
<p>Thanks! We’ll fix everything at once!</p>
16
<p>The code has changed, click “Refresh” or turn autorun on.</p>
16
<p>The code has changed, click “Refresh” or turn autorun on.</p>
17
<p>You’ve gone to a different page</p>
17
<p>You’ve gone to a different page</p>
18
<p>Click inside the mini-browser to shift the focus onto this window.</p>
18
<p>Click inside the mini-browser to shift the focus onto this window.</p>
19
<p>100%</p>
19
<p>100%</p>
20
<ol><li>Remove margin: auto from the .picture blocks,</li>
20
<ol><li>Remove margin: auto from the .picture blocks,</li>
21
<li>then set flex items to be distributed along the center of the main axis for the .pictures block,</li>
21
<li>then set flex items to be distributed along the center of the main axis for the .pictures block,</li>
22
<li>and center-align the cross axis.</li>
22
<li>and center-align the cross axis.</li>
23
<li>Then substitute space-around for arrangement along the main axis.</li>
23
<li>Then substitute space-around for arrangement along the main axis.</li>
24
</ol>
24
</ol>