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

Thematic Framework

I guess I will show off the the theme which I am using for this…

5 hours ago

WP-Membership

WordPress has emerged as not only a leading blogging platform but also a content management…

7 hours ago

Simple SEO: WordPress

Properly configured, Wordpress can be an extremely effective way of designing, maintaining and managing your…

19 hours ago

WordPress 2.7 Beta 3

WordPress 2.7 Beta 3 has been released for your testing pleasure. Here are some of…

1 day ago

How to: Add a contact me via Skype™ button

This little trick is really simple and easy. All you need to do is plug…

2 days ago

Review: WP-DBManager

This powerful plugin is a must-have for WordPress users. With WP-DBManager you can manage your…

2 days ago