Tribute Page User Story #9 Centering Image

I know how to solve user story #9 but I need to know why my previous attempt didn’t work.

First I read this FreeCodeCamp article to find out how to center images.

Based on the article, I needed to put text-align: block in the div, which I did on line 10. in my CSS. So why doesn’t it pass the test for user story #9???

I ended up fixing the issue by adding margin: auto to the image, but only because I saw this answer on another forum post. However, I’d still like to know why the above didn’t work.

EDIT: here is the link to my codepen

Without seeing your code all anyone will be able to do is guess.

I know if you read the entire failing error message (not just the first line) it tells you to use the display property with a value of block. (an image is not text)
However, when you do that the same test will still fail but with a different message. And it’s this message where you will need to use the margin propery with the auto value.

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