0

I am building a theme for a comic site. It seems some images are bigger than the post size. I need to resize the images according to the Original Image size. Can I achieve this through CSS? It doesn't matter if it extends the screen-size and scrolling window is shown.

0

Markup:

<div class="post">
    <div class="thumbnail">
        <img class="thumb" src="http://placehold.it/950x450/" />
    </div>
</div>

CSS:

.post { 
    width: 500px;
}

.post img.thumb {
    width: 100%; /* fill available space of parent and keep aspect ratio */
}

Fiddle: http://jsfiddle.net/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.