Help! Fixed width table with a 100% width image in it is assuming theimages intrinsic size, although

Discussion in 'HTML' started by satya.komatineni@gmail.com, Dec 29, 2007.

  1. Guest

    I have struggling with this for 2 days. I searched far and wide in
    google and msdn etc. No luck. Hope one of you may have seen this. I
    am
    seeing this in ie6 and ie7

    What I want
    **************
    1. A table with a single cell that is say 100px wide, laid out from
    left to right.
    2. I want to put an image in it and set its width to 100px as well


    What I expect
    ******************
    I see the image that is shrunk in width to 100px wide.


    Instead I see
    *******************
    1. I do see the image shrunk to 100px
    2. But I see the width of the "td" increased to 500px which is the
    size of the actual image


    Here is the source code for it
    *************************************
    <html>
    <head>


    <style>
    #test {background:blue}
    </style>


    </head><body>
    <p>before the table
    <table id="testt"><tr><td id="test" width="100px">
    <image width="100%" src="http://hiddenlakegardens.msu.edu/
    seasonal_interests/fall/fall1.jpg">
    </image>
    </td></tr></table>
    <p>after the table
    </body></html>


    Here is the URL you can use to see the blue background of the
    stretched "td"


    http://www.satyakomatineni.com/akc/display?url=DisplayNoteBodyURL&reportId=2400&ownerUserId=satya


    Does anyone know how to be able to say the width of an image to 100%
    while restricting its size using a container above such as a "td". I
    can fix this by fixing the image width, but then I have to deal with
    margins etc.


    Your help is much much appreciated.
     
    , Dec 29, 2007
    #1
    1. Advertising

  2. Re: Help! Fixed width table with a 100% width image in it is assuming the images intrinsic size, although it does shrink the image

    wrote:

    "Subject: Help! Fixed width table with a 100% width image in it is
    assuming the images intrinsic size, although it does shrink the image"

    Please choose Subject text that fits in the average newsreader's header
    pane, and is concise, please and thank you. About four to six words
    should do. (This is not Google. This is USENET.)

    > I have struggling with this for 2 days. I searched far and wide in
    > google and msdn etc. No luck. Hope one of you may have seen this. I
    > am seeing this in ie6 and ie7


    (Do you test in modern browsers as well? Firefox? Opera?)

    > What I want
    > **************
    > 1. A table with a single cell that is say 100px wide, laid out from
    > left to right.
    > 2. I want to put an image in it and set its width to 100px as well


    ...assumes an image 100px wide, correct?

    > What I expect
    > ******************
    > I see the image that is shrunk in width to 100px wide.
    >
    > Instead I see
    > *******************
    > 1. I do see the image shrunk to 100px
    > 2. But I see the width of the "td" increased to 500px which is the
    > size of the actual image


    Aha. As suspected, you need to resize the image. Doing that in HTML
    usually skews up the display of the image anyhow. Besides drastically
    adding to the download time of your page.

    > Here is the source code for it


    Don't post code; we don't have your images. Post the URL to your best
    effort test page. Someone might also have a much better way to do what
    you are attempting, which looks like "using tables for layout" a la 1996
    or so.

    --
    -bts
    -Friends don't let friends drive Vista
     
    Beauregard T. Shagnasty, Dec 29, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sean Jorden
    Replies:
    1
    Views:
    608
    laurie
    Aug 19, 2003
  2. cera
    Replies:
    1
    Views:
    1,299
    Neredbojias
    Aug 18, 2007
  3. Replies:
    7
    Views:
    192
    Tad McClellan
    Jun 22, 2006
  4. fred
    Replies:
    3
    Views:
    291
    Zifud
    Mar 17, 2005
  5. Replies:
    5
    Views:
    902
Loading...

Share This Page