Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Setting cell width without specifying it

Reply
Thread Tools

Setting cell width without specifying it

 
 
laredotornado@zipmail.com
Guest
Posts: n/a
 
      06-04-2007
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

 
Reply With Quote
 
 
 
 
Ben C
Guest
Posts: n/a
 
      06-05-2007
On 2007-06-04, http://www.velocityreviews.com/forums/(E-Mail Removed) <(E-Mail Removed)> 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">

[...]
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting the user control width on the web page width Gouri.Mahajan7@gmail.com ASP .Net 0 05-22-2008 11:39 AM
Can you force a 'break-word' wrap on a td without specifying its width? CRON HTML 10 11-03-2006 10:50 AM
Cell width error when containing variable width content mj.redfox.mj@gmail.com HTML 0 01-26-2006 03:37 PM
Textbox width scaling to width of data not width of page? AndrewF ASP .Net 1 10-10-2005 04:38 PM
css - setting width based on browser width ppcguy HTML 3 08-26-2005 06:51 AM



Advertisments