Centering images with text-align

https://www.codecademy.com/paths/web-development/tracks/build-interactive-websites/modules/web-dev-interactive-websites/projects/chore-door

Assign the text-align property a value of center .

Being called text-align, why does it center images? When do we center using margin: 0 auto; and when do we use text-align?

Well, text-align should not center images, because it applies to block containers, and not inline-elements, as the img tag is.

Rather do something clike

display: block;
margin: 0 auto;

That’s exactly what I was thinking, yet the exercise solutions suggest the opposite.