Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help !!!! On Table Cell Width !!

Status
Not open for further replies.

TrekFan

Programmer
Apr 23, 2003
25
CR
Hi there,

I’m working on generating html code for a data grid ... the idea is to allow the code be "small"…problem that I'm having is how to set "a fixed column width", regardless of the data in the column.

1)In the first attempt, I generated the following code:

<TABLE id=Testbody cellSpacing=0 width=120 border=1>
<TR>
<td style=&quot;WIDTH:60;&quot;> Data Data DataDatatadadsdsds</td>
<td style=&quot;WIDTH:60&quot;>MoreDataMoreData MoreDataMoreDataMoreDataMoreData</td>
</TR>
</TABLE>

But the columns width where dependent on cell contents !

2) On the second attempt, I got the following code:

<TABLE id=Testbody cellSpacing=0 width=120 border=1>
<TR>
<td style=&quot;WIDTH:60;OVERFLOW:hidden;&quot;> Data Data DataDatatadadsdsds</td>
<td style=&quot;WIDTH:60;OVERFLOW:hidden;&quot;>MoreDataMoreData MoreDataMoreDataMoreDataMoreData</td>
</TR>
</TABLE>

But the columns width where still dependent on cell contents !

3) My Third attempt generated the following code:

<TABLE id=Testbody cellSpacing=0 width=120 border=1>
<TR>
<td><span style=&quot;WIDTH:60;OVERFLOW:hidden;&quot;> Data Data DataDatatadadsdsds</span></td>
<td><span style=&quot;WIDTH:60;OVERFLOW:hidden;&quot;>MoreDataMoreData MoreDataMoreDataMoreDataMoreData</span></td>
</TR>
</TABLE>

In this one I got the desired result ... Bottom line is that I would like to achieve the fixed width without using spans or divs ... the ideal thing would be to define it on the td level and use a css class to “enforce it”

Any suggestions would be welcome !

Thanks for your help !!!!!


TrekFan
 
Code:
<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1>
	<TR>
		<TD width=&quot;200&quot;>Hello</TD>
		<TD width=&quot;500&quot;>World</TD>
		<TD width=&quot;100&quot;>Column</TD>
	</TR>
</TABLE>

-pete

 
Hi Pete

Thanks for your reply ... I didn't mention on the first note , but I already tried that ... and it is always cell content dependent

Thanks !

TF


 
Don't use your code. Take the code i posted an put it in an .htm file then open it in Internet Explorer. Then look a the difference between your old code and the new code.

-pete

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top