How to set max width of an image in CSS

前端 未结 6 623
陌清茗
陌清茗 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:45

    Your css is almost correct. You are just missing display: block; in image css. Also one typo in your id. It should be

    img.Image { max-width: 100%; display: block; }
    div#ImageContainer { width: 600px; }

提交回复
热议问题