css - Responsive images, scale down only -


i'm trying work out how make images responsive scale down only, solutions have found far use max-width:100% or max-width:??px these stretch image parent container , that's not result i'm after.

i have jquery fix:

 var ww = $(window).width(),      iw = $('img').width();   if(ww < iw) {   $('img').css('width',ww - 20);  } 

but css solution.

so have image 640px width if browser window wider 640px image should remain 640px wide , not stretched fit parent container, if browser window smaller , should image responsive fit inside browser window.

it should max-width, see demo.

img {     max-width: 100%;     height: auto; } 

http://jsfiddle.net/d5mlhdpp/


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -