Skip navigation
Currently Being Moderated

image in fluid layout

Sep 12, 2012 1:08 PM

Hi!

 

If I have a small image in a fluid layout column which is the best practice for having the image's width adjust to the column width while still remaining proportional with its height?

 

Thanks!

kt

 
Replies
  • Currently Being Moderated
    Sep 12, 2012 3:01 PM   in reply to Konstantinos Terzopoulos

    If your container is % based, you might try adding this to your CSS:

     

    img {max-width: 100%;}

     

    Also, don't give the image any HTML size attributes as this will default the CSS rule above.

     

    <img src="some_image.jpg" alt="description">

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 12, 2012 10:32 PM   in reply to Konstantinos Terzopoulos

    I am not sure about fixed height but to scale your image to your DIV width then this CSS will work?:

     

     

    img {

        width: inherit;

    }

     

    I suspect the height will also scale proportionately but another method is to use JavaScript which is for another forum to deal with.  This one is for pure DW.

     

    Your HTML might look like this:

     

     


    <img alt="pict01" src="http://www.psaltiki.org/_images/hagios_cover_small.jpg">

    <img alt="pict02" height="300px" src="sinai_syrmatiki.jpg">

     

    The second image contains a constrained height with a width of inherited from your DIV.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 13, 2012 8:29 AM   in reply to Konstantinos Terzopoulos

    Change this:

     

    <p align="center"><a href="cd/index.html"><img name="paraklesis_cover.jpg" src="/_images/paraklesis_cover_small.jpg" alt="Paraklesis CD cover" height="200" width="200"></p>

     

    to this:

     

    <p style="text-align:"center"><a href="cd/index.html"><img name="paraklesis_cover.jpg" src="/_images/paraklesis_cover_small.jpg" alt="Paraklesis CD cover"></p>

     

    HINT: resizing will be more noticeable with a slightly larger image.  200 x 200 is not very big.

     

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 13, 2012 10:15 AM   in reply to Konstantinos Terzopoulos

    Images are static by nature so when you re-scale them, some distortion and loss of picture quality are inevitable.

     

     

    Nancy O.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points