Tribute Page Image Help?

The bare bones of my tribute page are mostly fine, but the image CSS is causing me trouble. The one thing I can’t pass is:

  • Your #image should be centered within its parent.
    I’ve compared it to the HTML in the example as well as another student’s work and stackoverflow examples and I don’t know what I’m missing! Help please! Here’s the relevant code
    HTML:
  <div id="img-div">
          <img id="image" src="https://static.wixstatic.com/media/f026e9_461f682c80c94ca79bc6a0e529c9d754~mv2.jpg/v1/fill/w_255,h_335,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/DNGreenwood%20final_edited.jpg" alt="a picture of Dr. Greenwood">
          <figcaption id="img-caption">Dr. Greenwood</figcaption>
          </div>

CSS:


#image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  justify-content: center;
}

Here’s screenshots:


Let me know if I need to supply any more info, any help is appreciated!

(Note: In the screenshot it says I’m missing 3 things needed to pass, but the problem was in the boilerplate and I’ve since fixed those)

Please post all your code and a link to the challenge when asking for help.


edit: you can not use justify-content with display block it has to be flex or grid.

Did you try adding an auto margin?

margin: 0 auto ;
1 Like

It worked! Thank you so much, I’ll keep that handy rule as well as forum etiquette in mind

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