img element:
Use percentage for width;
Can we use css control to achieve:
No matter what device it is on: The height of img is always equal to the width
Just let img occupy the parent container of equal width and height. There are various postures. For example:
img
Link description
It’s okay to use the image as a background image, set height to 0 and padding-top to 100%.
Just let
img
occupy the parent container of equal width and height. There are various postures. For example:Link description
It’s okay to use the image as a background image, set height to 0 and padding-top to 100%.