Adam Lewison
Adam Lewison

Reputation: 25

Changing the size of a lot of different images with out affecting aspect ratio

Basically all I want is a whole bunch of images just one under each other. All these images are very different sizes and aspect ratios. I want all the images to be a maximum width and a maximum height without changing the aspect ratios of each image. How would i do this using html 5 and css3?

Upvotes: 0

Views: 67

Answers (1)

Mohinder Singh
Mohinder Singh

Reputation: 1830

Take a parent block, for example a div with a class name main_div and then add this CSS

.main_div img {
    width:100%;
    height: auto;
} 

Upvotes: 1

Related Questions