|
-
Jul 14th, 2002, 06:25 AM
#1
Thread Starter
Fanatic Member
Help getting pixel width of string
Hi,
I have a string in a table cell. Fistly, I want the cell not to wrap. I also want it so that, if the content of the cell will not fit without extending the cell, the content will either be totaly or partially hidden.
Javascript code, html solution needed. Thanx.
I am using the following for my no wrap, but I would like to know the style sheet syntax if anyone knows it:
-
Jul 14th, 2002, 06:30 AM
#2
Thread Starter
Fanatic Member
just for interest sake, I tried using the following in the hope that the html would do the work for me:
Code:
<td colspan=3 style="width : 1px;" nowrap>
<div width=100% style="overflow: hidden;" nowrap>January 2002</div>
</td>
-
Jul 14th, 2002, 11:00 AM
#3
Frenzied Member
If I understand you right this may work:
Code:
<td style="width : 50px; white-space:nowrap; overflow:hidden;">
January 2002
</td>
-
Jul 14th, 2002, 11:05 AM
#4
Thread Starter
Fanatic Member
Thanks for reply, bu alas, it did not do what I'm looking for.
Also Note: browser = IE6
-
Jul 14th, 2002, 12:52 PM
#5
Frenzied Member
Oh sorry, I'm out of ideas then The no wrap thing worked in mozilla but not the overflow. I think it's because overflow only applies to "block-level and replaced elements", I suppose that's not a table cell.
-
Jul 14th, 2002, 01:45 PM
#6
Addicted Member
This seems to work:
Code:
<table style="table-layout: fixed">
<tr>
<td style="width:20px">
<div style="white-space:nowrap">
Testing how this works
</div>
</td>
</tr>
</table>
-
Jul 15th, 2002, 01:00 AM
#7
Thread Starter
Fanatic Member
I have not found a solution to checking the pixel width of the string, but I found a work around. The cells I am using are all fixed widths, so I am just checking to see if the width is greater than the one that I specified. If it is, then I hide the contents of the cell. Thanks guys.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|