W3school states that we should use the height and width attributes in HTML for the img tag.
<img src="..." alt="" height="50" width="50">
But then I found this article that talked about how using width/height set to auto in CSS can cause the page render to make the page shift because the images are rendered after the text (https://www.smashingmagazine.com/2020/03/setting-height-width-images-important-again/). Using set width/height values works just fine, but with that method, it's hard to make the page responsive.
I currently have these styles set to my img...
width: 100%; max-width: 100%; height: auto; object-fit: contain;
... but they use the auto value.
In short, my question is this:
How do I follow the best practice of using the height and width attributes in HTML and at the same time be able to have a responsive design without the page shifting when it loads?
My page currently does not shift, but it's very simple and small as I'm learning. I'm worried that problems will occur if I continue to do this. So getting tips from people with more experience would be very appreciated!