View Screenshot
Note: This application does not work in Internet Explorer. I need a solution that is compatible with Chrome and Firefox.
I am using dynamic code (velocity-spring) to create an HTML table. The number of columns varies, so I cannot set widths for the headings. The second column always contains a link. The structure looks like this:
<table>
<tr>
<th ALIGN=CENTER> heading 1 </th>
<th ALIGN=CENTER> heading 2 </th>
... ... .... .. .. ..
<th ALIGN=CENTER> heading n </th>
</tr>
<tr ALIGN=CENTER>
<td ALIGN=CENTER> value 1 </td>
<td ALIGN=CENTER> <a href="mypage.html">value 2</a> </td> <!-- this column is a link -->
... ... .... .. .. ..
<td ALIGN=CENTER> value n </td>
</tr>
.... more rows follow
</table>
However, if the second column (containing the hyperlink) has a "loooooooooooooooooooooooong" value (without spaces), the other columns wrap their text. Can someone help me with CSS/JQuery/Javascript code to maintain the table structure regardless of the values from the back-end?
UPDATE:
After receiving a solution, I updated my table code as follows (advising to specify width
and use word-break
):
<table>
<tr>
<th ALIGN=CENTER> heading 1 </th>
<th style="word-wrap:break-word; width: 200px;" ALIGN=CENTER> heading 2 </th>
... ... .... .. .. ..
<th ALIGN=CENTER> heading n </th>
</tr>
<tr ALIGN=CENTER>
<td ALIGN=CENTER> value 1 </td>
<td ALIGN=CENTER style="word-wrap:break-word; width: 200px;"> <a href="mypage.html">value 2</a> </td> <!-- this column is a link -->
... ... .... .. .. ..
<td ALIGN=CENTER> value n </td>
</tr>
.... more rows follow
</table>
I understand the importance of accepting and upvoting helpful answers, and I will do so. Please assist me further. I am unable to provide a live URL, but I will attach screenshots soon.
View Screenshot