Setting cell width without specifying it

Discussion in 'HTML' started by laredotornado@zipmail.com, Jun 4, 2007.

  1. Guest

    Hi,

    I have a table of two rows. The first row contains a single cell with
    an image. The second row contains a cell with a smaller table,
    containing an image and text on the same row. My problem is, I want
    the width of the whole table to be the width of the image in the first
    row. However, I don't want to hard code this width because it might
    change. But right now, the second row's width is expanding to fill
    the entire browser screen. Can I restrict the second row's width to
    be the first row's width without hard-coding a pixel size?

    Here's the code:

    <table border="0" cellspacing="0" cellpadding="0">
    <tr><td><img name="coffee_header" alt="The Americas"
    src="images/coffeetheamerica.jpg" border="0"></td></tr>
    <tr><td>
    <table cellpadding="3" cellspacing="0"
    border="0">
    <tr>
    <td height="133" align="left"
    valign="top" bgcolor="cccc99"><p align="center"><img alt=""
    src="images/womanprocessing.jpg" width="200" height="121"></p></td>
    <td height="133" align="left"
    valign="top" bgcolor="cccc99" class="coffeeDesc">
    <p align="left"
    class="coffeeTitle">GUATEMALA ANTIGUA </p>
    <p align="left">A
    deeply flavorful, intense, full-bodied coffee with well-proportioned
    acidity and appealing aromas of spice and chocolate. This fine
    Bourbon variety coffee is shade grown at an altitude of 4,800 to 6,000
    feet on the Potrero Estate, one of the first plantations south of the
    ancient Guatemalan capital of Antigua. A small river still powers the
    old waterwheel that separates the coffee beans from the cherries. Well-
    balanced, Antigua coffee is good on its own and it blends well. </p>
    </td>
    </tr>
    </table>
    </td></tr>
    </table>


    Thanks for any help, - Dave
     
    , Jun 4, 2007
    #1
    1. Advertising

  2. Ben C Guest

    On 2007-06-04, <> wrote:
    > Hi,
    >
    > I have a table of two rows. The first row contains a single cell with
    > an image. The second row contains a cell with a smaller table,
    > containing an image and text on the same row. My problem is, I want
    > the width of the whole table to be the width of the image in the first
    > row. However, I don't want to hard code this width because it might
    > change. But right now, the second row's width is expanding to fill
    > the entire browser screen. Can I restrict the second row's width to
    > be the first row's width without hard-coding a pixel size?


    You can set the width of the cell in the second row to 1px. That won't
    make it 1px wide, but as narrow as possible without breaking words.
    Provided that that minimum width is narrower than the image in the first
    row, then the overall table width will be determined by the width of the
    image.

    > Here's the code:
    >
    > <table border="0" cellspacing="0" cellpadding="0">
    > <tr><td><img name="coffee_header" alt="The Americas"
    > src="images/coffeetheamerica.jpg" border="0"></td></tr>
    > <tr><td>

    ^^^^

    Change that one to <td width="1">

    [...]
     
    Ben C, Jun 5, 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. AndrewF
    Replies:
    1
    Views:
    810
    Bruce Barker
    Oct 10, 2005
  2. ppcguy
    Replies:
    3
    Views:
    1,287
    Toby Inkster
    Aug 26, 2005
  3. Replies:
    0
    Views:
    519
  4. CRON
    Replies:
    10
    Views:
    20,972
  5. Replies:
    0
    Views:
    500
Loading...

Share This Page