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

前端 未结 8 1153
萌比男神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 17:16

    As you also want support for media queries..You can use the following polyfill to add support for media queries to IE6-IE8

    https://github.com/scottjehl/Respond (very small in size, just 1-2kb minified and gzipped) then use the following css:

    @media screen and (min-width: 480px){
        img{
         max-width: 100%;
         height: auto;
       }
    }
    
    0 讨论(0)
  • 2021-02-14 17:19

    Doesn't IE 7&8 recognise the following:

    #my-div img
          {
             max-width:100%;
             _max-width:100%;
          }
    
    0 讨论(0)
提交回复
热议问题