Connecting Tech Pros Worldwide Forums | Help | Site Map

Remove White space from table <td>

tusovka's Avatar
Newbie
 
Join Date: May 2009
Location: Oregon
Posts: 18
#1: Aug 21 '09
I have a table with 6 columns

-------------------------------------------------------------
| Line | One | Two | Three | Four | Five |
-------------------------------------------------------------
| 1 | a | Two | Three | Four | Five |
-------------------------------------------------------------
| 2 | b | Two | Three | Four | Five |
-------------------------------------------------------------
| 3 | VeryLongString | Two | Three | Four | Five |
-------------------------------------------------------------
| 4 | d | Two | Three | Four | Five |
-------------------------------------------------------------

Each column has a class name. Eg ( class="col_one").
When the table is created, I can determine the length of each string.
(1,1,14,1)
Because, most of the data in that column is length (1) I would like to force a width on that particular column.
Sure the (VeryLongSting) will become (V) but I will include a button to expand the column if a user is interested in row (3).

Summary---
I'm trying to save the space and not have information pushed over to the
right due to a single long string.
How can I force a smaller <td> width.

Any other suggestion, or approaches are welcome.

gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,134
#2: Aug 22 '09

re: Remove White space from table <td>


might be a css with the max-width property could help?

kind regards
tusovka's Avatar
Newbie
 
Join Date: May 2009
Location: Oregon
Posts: 18
#3: Aug 24 '09

re: Remove White space from table <td>


-------------------------------------------------------------
| Line | One | Two | Three | Four | Five |
-------------------------------------------------------------
| 1 | a | Two | Three | Four | Five |
-------------------------------------------------------------
| 2 | b | Two | Three | Four | Five |
-------------------------------------------------------------
| 3 | Verysd| Twdsd|Trhehee| Four | Five |
-------------------------------------------------------------
| 4 | d | Two | Three | Four | Five |
-------------------------------------------------------------

When I specify a max width the the columns width behaves as told (40px)
But the text floats over the next to columns. As a result the adjacent columns are unreadable. How do i make the text hidden after 40px.

And I'm not talking about "NOWRAP" I would like to have all text after 40px not visible.
tusovka's Avatar
Newbie
 
Join Date: May 2009
Location: Oregon
Posts: 18
#4: Aug 24 '09

re: Remove White space from table <td>


style=\"max-width: 180px; overflow:hidden; text-align: right; \"

This did the trick. But I have another issue.
Here is a sample string( /home/cs123/hw_78/Now/important/info )

Column width
|----------------------|
/home/cs123/hw_78/Now/important/info

Visible info:
|----------------------|
/home/cs123/hw_7

What I need to see is:
|----------------------|
/ow/important/info

Note, the overflow works but text_align right is not working. Or the overflow only looks at the left side. How can I make this work?
gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,134
#5: Aug 24 '09

re: Remove White space from table <td>


hmmm ... i guess you might find better help with this issue in the html/css forum? i could move this thread to that forum if you think i should? ...

kind regards
tusovka's Avatar
Newbie
 
Join Date: May 2009
Location: Oregon
Posts: 18
#6: Aug 24 '09

re: Remove White space from table <td>


I think your right. Go ahead and move it over.

Thanks for yuor help...
gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,134
#7: Aug 25 '09

re: Remove White space from table <td>


moved from the JavaScript forum - done :)

kind regards
Reply