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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My problem is a bit tricky, but I w

Status
Not open for further replies.

TWillard

Programmer
Apr 26, 2001
263
US
My problem is a bit tricky, but I will do my best to explain.

PROBLEM:
--------
Netscape is NOT wrapping text for the best fit. The text will not fit into my defined cell width, therefore the cell is actually larger than what is defined. This is causing my table and page not to not line up correctly. IE on the other hand will break up text into more lines if necessary to find the best fit.

CODE SETUP:
-----------
I am displaying text into a table that is pulled from a DB via ASP. The table has 13 columns, with fixed widths on the table tag and the td tags. I do not have a fixed width on the height, because I want to allow vertical growth if necessary. The site needs to be IE5+ and NS6+ compliant.

EXAMPLE:
---------
<style>
.maintext {
font-family:arial,helvetica,verdana,charcoal,sans-serif;
font-size: 9px;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
color: #000000;
text-decoration: none
}
</style>

<table cellspacing=&quot;1&quot; cellpadding=&quot;2&quot; width='649'>
<tr valign='middle'>
<td align='center' width='80' class='maintext' >
1111111 222222222 3333333333 44444444 555
</td>
...
...


IE: (works great!!!)
1111111
222222222
3333333333
44444444 555

NS: (whats the deal???????)
1111111 222222222
3333333333 44444444
555


Youe help would be greatly appreciated.


 
You could try

<table cellspacing=&quot;1&quot; cellpadding=&quot;2&quot; style=&quot;width: 649px;&quot;>
<tr valign='middle'>
<td align='center' style=&quot;width: 80px;&quot; class='maintext'>
1111111 222222222 3333333333 44444444 555
</td>

But I don't know how NS will handle that.
 
How are your other cells? If you have content or a size defined for the other cells it may help to keep that cell in check.


É
<!--#include file=&quot;profound quotation&quot; -->
 
sweevo, thanks for the suggestion, but style=&quot;width: 80px;&quot; did not help.

cian - the table contains 13 columns each with a fixed width. All of the other columns' contents will fit into their appropriate cell. I know that the other columns are wide enough, because I looked at the largest possible content value for each column. I made sure that each column would hold its max value with extra white space on the side of the value.

The only exception for this is the first column row, which requires a word wrap on several of its content values.

However, for IE it works fine. And if NS would word wrap more efficently, then all of my columns would line up correctly.

Still looking for help...please..
 
FYI....UPDATE...SOLUTION

For this individual problem, I have to say that Netscape caused me quite a headache. After doing some HTML tag research, I learned that NS had redefined its behaviors for <nobr>text <wbr> here</nobr>. Check out these links for details:


Anyhow, since I working in ASP I decided to build a function that would be called for each of the contents display. This function will manually insert <wbr> tags into display text for the following characters: ' ','-','/','&'.. etc.

ie: 1111111 222222222-3333333333 44444444
1111111 <wbr>222222222-<wbr>3333333333 <wbr>44444444

This give Netscape more place in which in can wrap text. The code, although not final, is working and listed below.

<%
Function WordWrap(x)
x = Replace(x,&quot; &quot;,&quot; <WBR>&quot;)
x = Replace(x,&quot;-&quot;,&quot;-<WBR>&quot;)
WordWrap = x
End Function
%>

<tr>
<td>WordWrap(column_1)</td>
<td>WordWrap(column_2)</td>
...
...


This page returns over 1000 results. I have this function listed on 5 of the 13 columns. I have not noticed any speed difference, since adding this logic. The server seems to fly right through it.

Good Luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top