Hao Luo
Hao Luo

Reputation: 1891

Prevent or disable automatic image resize in a div with css (using bootstrap)

I'm trying to show the original size of the image. Often that's bigger than the width of the div that's containing it.

In modern browsers, it gets automatically resized to fit the parent div. Even when I use overflow: auto the image still gets resized.

So how can I prevent the image from getting resized when the outer div has a set width?

Thank you!

Upvotes: 14

Views: 61781

Answers (2)

Mike
Mike

Reputation: 41

I used this one img {min-width:100%}

Upvotes: 3

Pavlo
Pavlo

Reputation: 44937

Bootstrap have maximum width set to 100% on images. Change it:

img {
    max-width: none;
}

Upvotes: 24

Related Questions