Prevent your images from being too large

June 17, 2009 at 10:29 am

Every blogger like to put images in posts. After all, an image is worth a thousand words, isn’t it? But what if the images are too big, and break your blog layout? In this recipe, I’ll show a very easy but super cool tip to avoid this problem.

Simply paste the following in your style.css file:

.post img {
    max-width: 500px; /* Adjust this value according to your content area size*/
    height: auto;

Most WordPress themes display posts content within a <div class=”post”> tag. However, if the hack don’t work, make sure you have this tag on your single.php file.

Credits goes to Kyle Eslick for this useful hack!