How to set max width of an image in CSS

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

    I see this hasn't been answered as final.

    I see you have max-width as 100% and width as 600. Flip those.

    A simple way also is:

         
    

    I use this often, and then you can control individual images as well, and not have it on all img tags. You could CSS it also like below.

     .image600{
         width:100%;
         max-width:600px;
     }
    
         
    

提交回复
热议问题