Jump to content

How to prevent text breaking out of styles? wordwrap insufficient


amb99

Recommended Posts

Hi,

 

I am currently using the wordwrap() function to help prevent text from breaking out of the styles, but I'm having a problem when using many <th>'s <td>'s.

 

My table view looks like: (cut short for easier view)

 

<table class="q" width="100%" cellpadding="3" cellspacing="1" border="0">
<tbody>
<tr>
  <th class="q_key" nowrap="nowrap">Name</th>
  <th class="q_key" nowrap="nowrap">Class</th>
</tr>
<tr>
  <td align="center" valign="middle">{NAME}</td>
  <td align="center" valign="middle">{CLASS}</td>
</tr>
</tbody>
</table>

 

The variables of {NAME} and {CLASS} are:

 

$row_name = wordwrap($row['name']), 17, "<br>", 1);
$row_class = wordwrap($row['class']), 17, "<br>", 1);

 

The wrapping works fine, in the example above I'm only showing 2 total <th>'s and <td>'s, and it actually changes from having 6 total to 9 total, depending on the user rank. So the wrapping seems to be alright when having less <th>'s and <td>'s since there is more room for things. But when using more, things get squashed and the wordwrap of 17 is too high, I've tried to lower this to 10 to 14 but it starts looking ridiculous breaking after every word or 2 words!

 

Can I wordwrap the entire table without wordwrapping each variable? I've looked into word-wrap for css because I was thinking about placing the table inside some kind of word wrapping div but from my understanding that is a MS proprietary feature only. Is there any way whatsoever to add a strict boundary rule to the borders of the table (or something to place the table within)?

 

Thank you for any help !!!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.