Tribute Page - Build a Tribute Page

Tell us what’s happening:
Describe your issue in detail here.
Your #image should be centered within its parent. - What does this mean?

  **Your code so far**
/* file: index.html */
<!DOCTYPE html>
<html lang="en">
<link rel="stylesheet" href="styles.css">
<title id="title">
  Dr. Norman Borlaug</title>
  <body>
    <main id="main">
      <div id="img-div">
        <img id="image"></img>
      <div 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.</div></div>
      <p id="tribute-info">time line of <a target="_blank" href="https://en.wikipedia.org/wiki/Norman_Borlaug" id="tribute-link">Dr. Borlaug's life</a></p>
    </main>
  </body>
</html>
/* file: styles.css */
img {
display: block;
}
#image {
max-width: 100%;
height: auto;
display: flex;
flex-direction: row;
flex-wrap: wrap;
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/105.0.0.0 Safari/537.36

Challenge: Tribute Page - Build a Tribute Page

Link to the challenge:

find the img tag then find the parent of that img tag (the element that encloses it).
Center the img tag within that parent element.

#img-div > #image {
max-width: 100%;
height: auto;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}

is this correct?

I don’t think you need to do that specific style of selector.
It was enough to target the image with its id #image.

But perhaps you need a different style property(ies) to do the centering.

You can try to google “how to center img inside div” for eg.
Or you can try:
text-align: center;
margin: auto;

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.