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

7 Finest Places on Web to Find Excellent WP themes

Photographers, avid bloggers, tech junkies, and even food bloggers have shown their love & trust…

2 hours ago

WordPress VS Enterprise CMS – Which one to Pick?

WordPress has been one of the most dominating CMS and more domains are now going…

14 hours ago

Guidelines for Choosing the Best WordPress Theme for Your Website

Using a WordPress theme for a website comes with plenty of advantages. One great feature…

1 day ago

Top Six ways to Use QR Codes as a Web Design Tool

How can you link QR codes to digital content? When a QR code is read…

2 days ago

Should You Recycle Old Material to WordPress?

As a writer, or as a business owner doing some serious blogging, you probably wish…

2 days ago

The Complete In-Depth Guide to Getting Started with WordPress Development in 2022

Is WordPress Easy for Beginners? Yes, WordPress in all fairness is clean for novices to…

3 days ago