The most upvoted or accepted answers to this question are 10+ years old (2012). Trying to center an image using the idea they propose:
<p align="center">
<a href="https://www.yiiframework.com/" target="_blank">
<img src="https://www.yiiframework.com/image/yii_logo_light.svg" width="400" alt="Yii Framework" />
</a>
</p>
Causes my WebStorm yelling at me:
When I follow the "correct" (according to WebStorm) way:
<p style="text-align: center">
<a href="https://www.yiiframework.com/" target="_blank">
<img src="https://www.yiiframework.com/image/yii_logo_light.svg" alt="Yii Framework" />
</a>
</p>
Then image is not centered at all in GitHub front page of given repository (showing contents of README.md).
I have also tried this solution adapted to GitHub reality (no <style>
tag supported):
<a href="https://www.yiiframework.com/" target="_blank">
<img src="https://www.yiiframework.com/image/yii_logo_light.svg" alt="Yii Framework" style="display:block;margin-left:auto;margin-right:auto;" />
</a>
But, again, no effect -- image is again "glued" to the left margin.
So... which code must I use today (2023) to have image in README.md in GitHub centered, using methods that are not obsolete today?
` works. It doesn't matter that Webstorm points out the attribute is deprecated. [How do I center an image in the README.md file on GitHub?](https://stackoverflow.com/questions/12090472/how-do-i-center-an-image-in-the-readme-md-file-on-github)
– Andy Ray Jun 24 '23 at 21:13