WordPress Hack – Prevent Your Images From Being too Large

WordPress Hack - Prevent Your Images From Being too Large

Every blogger add images in their blogs. Images are necessary to attract reader attention. But if image used in post in is too big they can break your blog layout. You can automatically adjust image size according to your content area.
Simply paste the following in your style.css file:

.post img {
max-width: 500px; /* Adjust this value according to your content area size*/
height: auto;
}

You can set your own max image size in code. Most WordPress themes display posts content within a <div> tag. However, if the hack don’t work, make sure you have this tag on your single.php file.

  1. Liz Reply
    Thanks so much! After trying a few fixes, this was the only one that worked the way I needed. Thanks again! :)
  2. amlan Reply
    thanks...it worked...
  3. Jay Reply
    The height: auto; doesnt seem to work for me. Is anyone else having this issue?
  4. ngqabutho Reply
    #post-holder img { max-width: 800px; height:inherit !important; width: expression(this.width > 800 ? 800: true); } for ie support
  5. desjardy Reply
    Worked out great, thanks!

Leave a Reply

*

captcha *