Page 1 of 1

Quick Table Question

Posted: Sat Aug 01, 2009 4:47 am
by Alexx
Is anyone good with getting text inside a table to break to a new line once it hits the edge of the table? Trying all sorts of ways and having no luck :/

Making a profile system where you could like type in a little 'player description' about yourself in one of the tables but it just keeps widening the table width making it look ugly lol.

Re: Quick Table Question

Posted: Sat Aug 01, 2009 7:29 am
by Jackolantern
If you are wanting to allow the user to type in the text, it sounds like you need to use a form and implement a "text area" form element.

Re: Quick Table Question

Posted: Sat Aug 01, 2009 12:03 pm
by Falken
Just limit the width of each table cell, then it will automatically linebreak text and not widening the cell.

Code: Select all

<table>
   <tr>
      <td>Name: </td>
      <td style="width: 200px;">My loooooooooooong name</td>
   </tr>
   <tr>
      <td>Description:</td>
      <td style="width: 200px;">A nice very long description here which linebreaks if the cell is wider than 200pixels!!! MORE TEXT MORE TEXT MORE TEXT</td>
   </tr>
</table>
Or you could just write in your CSS file if you got one:

Code: Select all

td
{
   width: 200px;
}

Re: Quick Table Question

Posted: Sat Aug 01, 2009 4:20 pm
by Alexx
Falken wrote:Just limit the width of each table cell, then it will automatically linebreak text and not widening the cell.

Code: Select all

<table>
   <tr>
      <td>Name: </td>
      <td style="width: 200px;">My loooooooooooong name</td>
   </tr>
   <tr>
      <td>Description:</td>
      <td style="width: 200px;">A nice very long description here which linebreaks if the cell is wider than 200pixels!!! MORE TEXT MORE TEXT MORE TEXT</td>
   </tr>
</table>
Or you could just write in your CSS file if you got one:

Code: Select all

td
{
   width: 200px;
}
Bah, I know I tried setting the width a few times...was confused why it wouldn't work lol. Thanks for the help bro, I copied yours and it works smoothly now :)

I need to stop coding late at night, hehe. ;)