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

powered by WassUp

Recent Posts: Fully Net Worth . com

Linda Fairstein Net Worth- How Rich is Linda Fairstein Actually?

Linda Fairstein Net Worth- How Rich is Linda Fairstein Actually?

Linda Fairstein is an American author and former prosecutor. She was the head of the sex crimes of the Manhattan District Attorney’s office from 1976 to 2002. As of 2019, Linda Fairstein net worth is estimated to be $12 million. Born on May 5, 1947, in New York, Linda attended Vassar College where she received […]

Hunter Biden Net Worth: How Rich is Joe Biden’s Son Actually?

Hunter Biden Net Worth: How Rich is Joe Biden’s Son Actually?

Robert Hunter Biden is an American lawyer and lobbyist. He is the son of former U.S. Vice President Joe Biden. He was recently accused by President Donald Trump over being protected from a Ukrainian prosecutor but those claims have been shown to be false. As of 2019, Hunter Biden’s net worth is estimated to be […]

Don Toliver Net Worth: How Rich is the Rapper in 2019?

Don Toliver Net Worth: How Rich is the Rapper in 2019?

Caleb Zackery Toliver, who is better known by his stage name as Don Toliver, is an American rapper and songwriter. He gained a big following after rapping a killer verse on Travis Scott’s single called “Can’t Say” in his much sought after album called Astroworld that released in 2018. As of 2019, Don Toliver net […]

%d bloggers like this: