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

Advertisements
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

powered by WassUp

Recent Posts: Fully Net Worth . com

Darius Garland Net Worth: 5 Interesting Facts You Should Know

Darius Garland Net Worth: 5 Interesting Facts You Should Know

Darius Garland is an American basketball player who used to play for the Southeastern Conference (SEC) team called Vanderbilt Commodores. His competency can be seen from the fact that he is a five-star recruit as well as a McDonald’s All-American. 1. Early Life Garland was born on January 26, 2000, in Gary, Indiana. In his early childhood, he played […]

Harold Lederman Net Worth: How Rich Was Boxing Legend Actually?

Harold Lederman Net Worth: How Rich Was Boxing Legend Actually?

Harold Lederman was a boxing judge and analyst. He was in boxing for around 5 decades. Harold Lederman net worth before his death is estimated to be $3 million. Lederman was born on January 26, 1940, in The Bronx, New York. He went to Columbia University and after graduation earned a license from New York’s […]

Pua Magasiva Net Worth: How Rich was Pua Magasiva Actually?

Pua Magasiva Net Worth: How Rich was Pua Magasiva Actually?

Pua Magasiva was a New Zealand actor best known for his role as Shane Clarke, the Red Ranger from Power Rangers Ninja Storm. Pua Magasiva net worth before his death is estimated to be $600,000. Magasiva was born on August 10, 1980, in Apia, Samoa but was raised in Wellington, New Zealand since he was […]

%d bloggers like this: