Last time we looked at the withdrawal option. images from a folder in PHP.
From the above example, we realized that the image is displayed on the page using HTML tags.
And the dimensions of the picture, we registered directly in the HTML code.
Now I’ll show you how to set the image size using the stylesheet. All this data will be placed in a separate file with the css extension and name it as an example style.css.
Image dimensions are set by the width and height parameters.
In order to set the dimensions for the image and register it through the CSS file, you need to create a class for the src tag. For example, write>
Then in the css file the dimensions will be written this way
With this recording option, if the actual image height is more than 170 pixels, for example, 400 pixels, then a distorted image will be displayed on the page. It will be flattened.
In order to avoid this, you can set only one parameter, the image width, the default height will be set without automatically violating the image proportions:
In the same way, you can set the height height, then the width will be set automatically maintaining the image proportions.
If we want to see the actual size of the image, then it is not necessary to specify the size of the image in the file. Only if we approximately know that the image size occupies the entire page, then there should not be any tags on the page specifying the size.
For example, a table