javascript - [CSS] Can CSS make the height and width of img equal?
習慣沉默
習慣沉默 2017-06-28 09:26:36
0
2
908

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

習慣沉默
習慣沉默

reply all(2)
ringa_lee

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%.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template