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

Maintenance release for Hybrid 0.5

Today has released an update to his Hybrid Theme. Version 0.5.1 can be found at…

1 hour ago

Using the swekey on your blog

If you've downloaded the Swekey plugin and plan on using it for users to login…

13 hours ago

April’s new meetup location for LAWPUG

Anyone in the Los Angeles area? Well the first Sunday of the month is the…

1 day ago

‘Portal’ And ‘Left 4 Dead 2’ Arrive On Linux

Steam is powerful, hot, and painful. It can move trains, boats, and has driven minds…

2 days ago

Swekey: A safe web enabler usb?

I received a Swekey in the mail this week. What's a Swekey you ask? Like…

2 days ago