Fit images into specified space

ellescuba27

Member
Messages
273
Reaction score
3
Points
18
Hey there x10hosting! I need your help with HTML, CSS, and Javascript if nessecary. I am going to have a box, for example purposes, let's say it is 400x400px. Maybe a <div> tag set to that size for example. What I need to do is be able to fit any number of images, maintaining aspect ratio, to the closest fit of the whole box, so if I had four images in a 400x400px box, and they were all perfect squares, you would have two images up and down, and two left and right. Meanwhile, if the images were all different sizes, it would try fit fit them close to the edge keeping their aspect ratio (although you might still be able to see their background). Any ideas?
 
Top