Tell us what’s happening:
Describe your issue in detail here: I’m having trouble centering an image within its parent container using CSS. Despite trying various methods, my code is still not being accepted, and I’m seeking assistance to achieve the desired centering effect."
Your code so far
<!-- file: index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="styles.css">
</head>
<body>
<main id="main">
<h1 id="title">Dr. Noraman Bourlag</h1>
<figure id="img-div">
<img id="image">
<figcaption id="img-caption">
Dr. Norman Borlaug, third from the left, trains biologists in Mexico on how to increase wheat yields - part of his life-long war on hunger.
</figcaption>
</figure>
</div>
<div id="tribute-info">
<h3>Here's a timeline of Dr. Bourlags life</h3>
</div>
<a id="tribute-link" href="#" target="_blank"></a>
</main>
</body>
</html>
/* file: styles.css */
img{
display: block;
max-width: 100%;
}
#image{
max-width: 100%;
height: auto;
margin: auto;
}
#img-div{
display: flex;
justify-content: center;
align-items: center;
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
Challenge: Tribute Page - Build a Tribute Page
Link to the challenge: