How to set an image's width and height without stretching it?

前端 未结 12 1590
南旧
南旧 2020-11-28 05:22

If I have:

#logo {
    width: 400px;
    height: 200px;
}

then


12条回答
  •  难免孤独
    2020-11-28 05:39

    Do I have to add an encapsulating

    or ?

    I think you do. The only thing that comes to mind is padding, but for that you would have to know the image's dimensions beforehand.

提交回复
热议问题