resize table column width to less than the minimum width |
resize table column width to less than the minimum width |
weblogfinder |
Jan 24 2011, 11:29 PM
Post
#1
|
Newbie Group: Members Posts: 12 Joined: 20-January 11 Member No.: 13,642 |
Hi,
I have a table as below: <table> <tr> <td>asdf</td> <td>defg</td> </tr> </table> How can i reduce the width of each column less than length of "asdf" or "defg" i.e if the table displays as asdf|defg I would like to customize the table display as: as|defg df| Can any one please let me know how can i proceed with this and need any further info. |
Darin McGrew |
Jan 24 2011, 11:44 PM
Post
#2
|
WDG Member Group: Root Admin Posts: 8,365 Joined: 4-August 06 From: Mountain View, CA Member No.: 3 |
AFAIK, you can't do that without splitting the word that you want to wrap.
|
pandy |
Jan 25 2011, 12:39 AM
Post
#3
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
Especially not with a table.
|
Frederiek |
Jan 25 2011, 02:29 AM
Post
#4
|
Programming Fanatic Group: Members Posts: 5,146 Joined: 23-August 06 From: Europe Member No.: 9 |
You could set an unvisible hyphen sign (& shy; [edit: had to add the spaces or nothing showed up]) everywhere you want the text to be able to wrap. That's a lot of work, so you might use a script for that.
This post has been edited by Frederiek: Jan 25 2011, 02:31 AM |
pandy |
Jan 25 2011, 03:17 AM
Post
#5
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
Soft hyphen doesn't work with tables. They still expand, at least in the browsers I've tried.
|
Christian J |
Jan 25 2011, 05:54 AM
Post
#6
|
. Group: WDG Moderators Posts: 9,653 Joined: 10-August 06 Member No.: 7 |
I could make
CODE ­ work in all but Firefox. But the WBR element (included in HTML5) works in all but Opera and doesn't create a hyphen. |
pandy |
Jan 25 2011, 07:51 AM
Post
#7
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
Can't get them all, eh? Seems like improvements have been made anyhow.
|
weblogfinder |
Jan 25 2011, 02:22 PM
Post
#8
|
Newbie Group: Members Posts: 12 Joined: 20-January 11 Member No.: 13,642 |
So you mean we cannot do with regular table/td options available?.
How can i use this "shy" in my code?. Also, what are the other options, apart from the js shown above (i couldn't make it work with my html file.) |
Christian J |
Jan 25 2011, 02:44 PM
Post
#9
|
. Group: WDG Moderators Posts: 9,653 Joined: 10-August 06 Member No.: 7 |
So you mean we cannot do with regular table/td options available?. I don't think it's a table issue. Text strings don't normally break except between certain characters: http://www.cs.tut.fi/~jkorpela/html/nobr.html QUOTE How can i use this "shy" in my code?. Since Firefox apparently doesn't support ­ in tables (do you have to use a table?) I'd use WBR instead: CODE a<wbr>s<wbr>d<wbr>f QUOTE Also, what are the other options, apart from the js shown above (i couldn't make it work with my html file.) Options for what, adding the "breakable code" in text? Besides JS you might do it with a server-side script (e.g. PHP). |
Frederiek |
Jan 28 2011, 08:37 AM
Post
#10
|
Programming Fanatic Group: Members Posts: 5,146 Joined: 23-August 06 From: Europe Member No.: 9 |
I just found a way to do this with CSS3's "word-wrap: break-word;", see http://robertnyman.com/css3/word-wrap/word-wrap.html .
|
Christian J |
Jan 28 2011, 09:10 AM
Post
#11
|
. Group: WDG Moderators Posts: 9,653 Joined: 10-August 06 Member No.: 7 |
That used to be a proprietary MSIE property. Seems all the newest browser versions support it now (not Firefox2 or Opera9 though).
|
Barthal |
Jan 31 2011, 05:31 AM
Post
#12
|
Member Group: Members Posts: 50 Joined: 22-November 10 Member No.: 13,209 |
Technically you could if you started to go deep into nesting, but it's not worth the trouble
|
Lo-Fi Version | Time is now: 19th April 2024 - 05:18 PM |