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.
.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. 🙂
Classic CTR Themes For WordPress have made it pretty easy to build informational websites using…
In today's techno-centric culture, you simply must have a business website, no matter how small…
Photography is the art of capturing naturalistic images with the help of photographic cameras. It…
Have you opened up a new website or a business and want to drive more…
WordPress has evolved greatly from its origin as a powerful blogging platform to an effective…
Busіnеsѕеs аnd orgаnіzatіоns аll аrоund the wоrld arе loоking fоr а ѕоlutiоn thаt wоuld prоvе…
View Comments
Simple but very useful css trick, thank you :)
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 probably should have written that. Any way, this CSS should go into either an external stylesheet (like, style.css) or in the page head in between
Thank you!
cardiogirl´s last blog post..The book of questions, Volume 35
Oops. I did paste my code from an image in one of my posts and it did not show on my previous comment.
cardiogirl´s last blog post..The book of questions, Volume 35
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! =-.