What is the difference between the width and height of the picture written in width height and css?

I have done a mobile function to simulate scrolling. The scrolling container contains pictures arranged vertically. At the beginning, I wrote the width and height of the pictures in css. Because the simulated scrolling needs to obtain the height of the container, but in this case, the height obtained is always dozens of pixels smaller than the actual height, resulting in scrolling not to the end. Later, it is normal to set the width and height on the width and height properties of img.
so for a picture, what"s the difference between setting width and height in css and setting width and height in the width height property?

The permissions set on

css are higher than those set directly on img.
inherent size: the size of the img image itself. If the html size is not set and the Css size is not set, the inherent width and height of the resource image is displayed.
html size: if the height,width property is set through html, and there is no Css limit, it will be displayed as html size.
Css size: the width and height are set by the Css property, which is shown as the result of the Css property setting.

Menu