Home > Web Front-end > HTML Tutorial > The display size of html static page images is wrong_html/css_WEB-ITnose

The display size of html static page images is wrong_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:15:29
Original
1680 people have browsed it

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


Reply to the discussion (solution)

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.

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template