Categories: Tips & Tricks

Sick of images being to large for the content area?

Have you ever uploaded an image that might have been a tad bigger than the width of your content area? I know I have! So here is a little CSS fix to handle these situations.

Resize those large images using CSS

.post img {
 max-width: 600px;
 height: auto;
 }

That’s it, really simple huh. Just make sure that you change the .post to the correct body class(which starts with a “.“) or body ID(which starts with a “#“).

Would you like a quick explanation?
The CSS is just telling any image inside the class of .post to not be more than 600px wide. By the way make sure you change it to fit the dimension of your content width. And the height attribute is set to auto to automatically change the height to match the new width. 🙂

Web Master

Hi, I am Miguel, I bought this site in 2009. So I now run or manage the site. Please visit my new website or follow me on twitter @W3i.

View Comments

  • Hi there, found you through a re-tweet from Lyndi. I love this fix but I am very code-illiterate. Also, attempting to learn XHTML instead of HTML. Where would this go, in the Stylesheet.php or would it go in the post where the image is

    It seems like it would go in the style sheet as an overall rule, right?

  • I was searching the internet trying to find an easy way to do this. In the past I was loading and reloading my images to make them fit properly. I have bookmarked your site and will check it out more in the future.
    .-= Beavisthecat´s last blog ..Happy Labor Day! =-.

Recent Posts

Add additional meta boxes to Hybrid Theme

At the time of writing this post I have Theme Hybrid as my parent theme,…

6 hours ago

What do Software as a Service (SaaS) Companies Do?

What do Software as a Service (SaaS) Companies Do?

6 hours ago

And the winners who receive a free book are.

See, I really did pull the winner out of a hat, lol. Well In my…

1 day ago

45X Ways to Skyrocket Your Search Traffic

This Traffic guide offers 45 strategies to boost search traffic, focusing on technical SEO, content,…

2 days ago

How to: Display RSS feeds from anywhere

Here is a simple way to display any RSS feed in your WordPress blog. <?php…

2 days ago

21 Effective Strategies to Amplify Website Traffic

The article provides a comprehensive guide to driving traffic to your website, highlighting 21 effective…

3 days ago