css highly adaptive Pictures

Began to use js, get the screen width, set the aspect ratio according to the image size.

var wid = window.screen.width;
wid = wid * 0.85;
$('.Img').css('width',wid+'px');
$('.Img').css('height',wid/15*26+'px');

End mobile phone / computer test no problem, but the PC version comes with a micro-channel will be deformed when the browser is open, because the screen width of 1920.

Solution: use css

{.img 
    width: 90%; // not set height, allowed adaptive 
}

 

Guess you like

Origin www.cnblogs.com/linjiangxian/p/11464672.html