Connect with us

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

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. 🙂

7 Comments

7 Comments

  1. Trecar.it

    March 27, 2009 at 1:30 pm

    Simple but very useful css trick, thank you 🙂

  2. Pingback: Weekend Links - Mar 28, 2009 | OMNINOGGIN

  3. cardiogirl

    March 28, 2009 at 5:27 am

    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?

    • Austin

      March 28, 2009 at 2:10 pm

      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

      <style type="text/css">
      .post img {
      	max-width: 600px;
      	height: auto;
      	}
      </style>
  4. cardiogirl

    March 28, 2009 at 5:28 am

    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

  5. Beavisthecat

    September 8, 2009 at 9:54 am

    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! =-.

You must be logged in to post a comment Login

Random Search Terms

Title

Top Articles

Top Searches

powered by WassUp

Recent Posts: Fully Net Worth . com

Daequan Loco Net Worth: How Rich is the Streamer Actually?

Daequan Loco Net Worth: How Rich is the Streamer Actually?

Daequan Loco is an American Twitch streamer as well as a Youtuber. Through his expertise in playing the game Fortnite, Loco has been able to establish a large following on Twitch with him currently having over 3.7 million followers on the platform. Moreover, he also plays the games Battlefield V, Maplestory 2, Earthfall, Overwatch, Outlast, […]

Michael Sterling Net Worth: 5 Facts You Need To Know

Michael Sterling Net Worth: 5 Facts You Need To Know

Michael T. Sterling is a professional lawyer who is best known to the public as the husband of actress, model, and television personality Eva Marcille. She has risen to popularity after winning season three of America’s Next Top Model. Here are five interesting facts about Michael Sterling including his personal life, net worth, wife, and […]

Lil Uzi Vert Net Worth: Know Everything About Him.

Lil Uzi Vert Net Worth: Know Everything About Him.

Lil Uzi Vert Net Worth: Know Everything About Him. If you are into hardcore rapping, then you must have heard about Lil Uzi Vert. He is an American rapper and songwriter who rose to fame after his hit single ‘Bad and Boujee’ that ranked number 1 on the US Billboard Hot 100. Lil Uzi was […]

%d bloggers like this: