Can div css achieve equal scaling of images? How to implement it specifically?
No, it will only cut the picture (not to scale).
You can use JS to solve it. It is recommended to ask in the JS version.
Scale proportionally? Not arbitrary cropping? According to the proportion of the original body, you can set the height of the img and have fun!
It seems that some people are using js to modify the width and height of the image according to the scrolling of the mouse, but the effect is definitely not very good
Yes. Whether it is CSS or JS, as long as a fixed length or height is specified (choose one, but not both at the same time), it will automatically scale according to the original length and height ratio.
And you can also use relative sizes like percentages.
css uses % but there must be a maximum value to avoid distortion
The professional point is called fluid/elastic image Google's
zoom: 1 means no zoom, zoom: 0.8 means 80% reduction
Yes. Whether it is CSS or JS, as long as a fixed length or height is specified (choose one, but not both at the same time), it will automatically scale according to the original length and height ratio.
1
As long as the height and width are not defined at the same time, they can be scaled in equal proportions
As long as the width and height of the div are larger than the img to be changed, the size can be changed by changing the width and height of the img
The image has a max-width attribute. Try setting it to the width of the parent container div