githubからDLします。
https://github.com/fregante/object-fit-images
ofi.jsを配置します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | < style > .object-fit{ object-fit: contain; font-family: 'object-fit: contain;' } </ style > </ head > < body > < div class = "container" > < img src = "img/img1.jpg" class = "object-fit" width = "400px" height = "200px" >< br >< br > </ div > < script src = "js/ofi.js" ></ script > < script > objectFitImages('img.object-fit-img'); </ script > </ body > |
ほう