Hi, I’m currently doing the first project on HTML/CSS — Tribute Page.
Questions:
- Can somebody explain to me why should I use
display: block;inimg? I only know to put block as it’s stated inside the tests error. (In the course I’ve only learneddisplay: flex&display: grid - Without giving me the answer, maybe by hints. How do I make the image be centered? I tried using
align-items: center(so that the flex items are centered along the cross axis) but it doesn’t seem to work.
HTML CODE:
<!DOCTYPE html>
<html>
<head></head>
<body>
<header></header>
<main id="main">
<h1 id="title">Dr. Norman Borlaug</h1>
<div id="img-div">
<img id="image" src="https://cdn.freecodecamp.org/testable-projects-fcc/images/tribute-page-main-image.jpg" alt="">
<p id="img-caption">Dr. Norman Borlaug, third from the left, trains biologistin Mexico on how to increase wheat yields - part of his life-long war hunger.</p>
</div>
<h2 id="tribute-info">Here's a timeline of Dr. Borlaug's life:</h2>
<a id="tribute-link" href="https://en.wikipedia.org/wiki/Norman_Borlaug" target="_blank"></a>
</main>
<footer></footer
</body>
</html>
CSS Code:
img {
display: block;
max-width: 100%;
height: auto;
}
#img-div {
display: flex;
align-items: center;
}


