How to auto resize the image for responsive design with pure css?

前端 未结 8 1151
萌比男神i
萌比男神i 2021-02-14 16:27

I have tried to auto resize the image using the CSS property max-width, but it does\'t work in IE7 and IE8. Is there any way to auto resize the image with pure CSS

8条回答
  •  太阳男子
    2021-02-14 16:58

    Use max-width: 100% with height:auto, plus width:auto for IE8:

    img 
     {
     max-width: 100%;
     height: auto;
     }
    
    /* Media Query to filter IE8 */
    @media \0screen 
      {
      img 
        { 
        width: auto;
        }
      }
    

提交回复
热议问题