Use css in html to control the size of an image. The value in css is a percentage. Why does the page display sometimes have the effect you want and sometimes it is very small?
Asking for help from the masters
You need to figure out the percentage relative to whom,
For example,
50% of 1000 is 500
50% of 100 is 50
The specific size is determined according to the size of the container
You have to figure out whose percentage it is relative to,
For example
50% of 1000 is 500
50% of 100 is 50
The specific size is determined by the size of the container
Then why does there appear When the reality is correct, sometimes the picture displayed is very small? If a status is always displayed, it means that the size of the container I selected is incorrect. The problem is that it is displayed correctly many times now. About 30% of the time when I visit this page, it is displayed incorrectly.
This depends on how your code is written
The IMG percentage written by the poster should be one of the following two situations:
1.
< ;body>
2.
Maybe it's actually possible There are more nested containers, but in the final analysis, all containers start like this from the body to the IMG. And the BODY itself does not set a fixed width.
Therefore, the actual value calculated by the final percentage of IMG depends on the actual value of BODY given by the current browser window. Therefore, if the browser window changes size, the image will change size.
Or the browser window does not change size, but the IMG external container is relative to a container that changes size under different circumstances, so the image size is different.
The poster added a BORDER to the container where the IMG is located. If you observe it under the different situations you mentioned, you can see what problem caused the size of the external container of the IMG to change.