CSS max-width autoresize not working for height resize

Discussion in 'CSS' started by nokia3310, Feb 26, 2011.

  1. #1
    Hi guys i am using the css max-width to auto resize the images in wordpress post but the images are not properly autoresized that is only the width is resized and not the height.

    How can i have a autoresize both of the width and height of the images?


    .postclass img {
    max-width: 500px;
    width: expression(this.width > 500 ? 500: true); }
     
    nokia3310, Feb 26, 2011 IP
  2. Bapinder

    Bapinder Well-Known Member

    Messages:
    151
    Likes Received:
    7
    Best Answers:
    3
    Trophy Points:
    120
    #2
    .postclass img {
    max-width: 500px;
    max-height: 500px;
    width: expression(this.width > 500 ? 500: true);
    height: expression(this.height > 500 ? 500: true);
    }

    Try that.
     
    Bapinder, Feb 27, 2011 IP
  3. nokia3310

    nokia3310 Peon

    Messages:
    191
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    nah that will make the image look like a monster..lol
    its called autoresize not max width and max height
     
    nokia3310, Feb 27, 2011 IP
  4. Bapinder

    Bapinder Well-Known Member

    Messages:
    151
    Likes Received:
    7
    Best Answers:
    3
    Trophy Points:
    120
    #4
    Last edited: Feb 27, 2011
    Bapinder, Feb 27, 2011 IP