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

前端 未结 8 1192
萌比男神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:52

    Try something like this:

    width: expression(document.body.clientWidth > 800 ? "800px" : "auto" );
    
    /* If page is wider than 800px then set width to 800px, otherwise set to auto */
    

    Source (worth taking a look at)

提交回复
热议问题