How to maintain aspect ratio using HTML IMG tag

前端 未结 10 1514
面向向阳花
面向向阳花 2020-12-23 02:42

I am using an img tag of HTML to show a photo in our application. I have set both its height and width attribute to 64. I need to show any image resolution (e.g. 256x256, 10

10条回答
  •  粉色の甜心
    2020-12-23 03:15

    Why don't you use a separate CSS file to maintain the height and the width of the image you want to display? In that way, you can provide the width and height necessarily.

    eg:

           image {
           width: 64px;
           height: 64px;
           }
    

提交回复
热议问题