PDA

Click to See Complete Forum and Search --> : Wrap text in table-cell


onerrorgoto
Aug 7th, 2003, 09:26 AM
I'm trying to imitate the listview from MS in my page but have some problem with the size of cells in my table.

Q1.
I dont want the size of my "header"-cells to expand if the text is to large. I want the text to wrap instead. I have tried to set the td-width to px instead of % but that didn't work.

Q2.
Is there any javascript that lets the user resize the width of the
cells by dragging the border or dbl-kclick like in the listview?


<table border="1" width="50%" cellspacing="0" cellpadding="0">
<tr>
<!-- header-->
<td width="100%">
<table border="0" width="100%" cellspacing="0">
<tr>
<td width="22%" bgcolor="#FFFF99">
<p align="center">A</p>
</td>
<td width="22%" bgcolor="#FFFF99">
<p align="center">B</p>
</td>
<td width="22%" bgcolor="#FFFF99">
<p align="center">C</p>
</td>
<td width="22%" bgcolor="#FFFF99">
<p align="center">D</p>
</td>
<td width="5%" bgcolor="#FFFF99">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<!-- Content -->
<td width="100%">
<span style='OVERFLOW: auto; WIDTH:100%; HEIGHT:170; BORDER-RIGHT: 1pt solid; BORDER-TOP: 1pt solid; BORDER-LEFT: 1pt solid; BORDER-BOTTOM: 1pt solid'>
<table align="left" border="1" width="100%">
<tr>
<td width="25%">A1</td>
<td width="25%">B1</td>
<td width="25%">C1</td>
<td width="25%">D1</td>
</tr>
<tr>
<td width="25%">A2</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">A3</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">A4</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">A5</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">A6</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">A7</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">A8</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
</table>
</span>
</td>
</tr>
</table>

phpman
Aug 13th, 2003, 12:31 AM
A1) you have to set the pixels in the width and not percentages. the text in the cell has to be broken and cannot be continious.

A2) no you cannot resize a table. maybe a div but not a table.

you can not yuse a span tag like that. span tags are for text and not to hold things like a table. you want a div tag as that will hold it and also use the overflow property like you want. also div tag is a block level element so you might have better luck on getting it to resize by the user if you hook some javascript or DHTML on it.

look at http://www.dhtmlcentral.com/ as they use what you want.

CornedBee
Aug 13th, 2003, 02:06 AM
A span is an inline element and may not contain anything but inline elements (that is, no tables, no blocks and of course no table or list parts).