How to set max width of an image in CSS

前端 未结 6 641
陌清茗
陌清茗 2020-12-08 06:00

On my website I would like to display images uploaded by user in a new window with a specific size (width: 600px). The problem is that the images may be big. So

6条回答
  •  盖世英雄少女心
    2020-12-08 06:43

    The problem is that img tag is inline element and you can't restrict width of inline element.

    So to restrict img tag width first you need to convert it into a inline-block element

    img.Image{
        display: inline-block;
    }
    

提交回复
热议问题