| View previous topic :: View next topic |
| Author |
Message |
bebil
Joined: 21 Oct 2005 Posts: 2
|
Posted: Fri Oct 21, 2005 8:56 am Post subject: TABLE fixed width -how to? |
|
|
Hi guys,
I got a table and I insert information into it from a textarea (not important). My problem is that I specify the width =164 and also the width of the TD as 164. i also have put the nowrap tag in the TD.
However when info is entered into the table and its bigger than 164 wide it just expands the width instead of scrolling below onto the next line.
I have also tried to put the content in the TD into a DIV (with width of 164 ) but still no luck.
code:
<table width="164" border="0" class="contentTableRight" >
<tr>
<td width="164" nowrap><h2>Latest Work</h2>
<div style="width:164px">
<?
if (isset($textHTML))
echo($textHTML);
?>
</div>
</td>
</tr>
</table>
PLEASE can someone advise me to as whats causing it to extend or what I can do to restrict it.
thanks in advance |
|
| Back to top |
|
 |
|
|
webmaster Site Admin

Joined: 17 Aug 2004 Posts: 3642 Location: Sweden
|
Posted: Fri Oct 21, 2005 9:29 am Post subject: Re: TABLE fixed width -how to? |
|
|
I can't figure out a good way to do it in HTML. But this is some things you can do with PHP. Try this:
PHP: <?php $textHTML = "11111111111111111111111111111"; ?>
<table border="0">
<tr>
<td bgcolor="red" width="164">
<?php
if (isset($textHTML)) {
if(strlen($textHTML) >= 18) {
echo substr($textHTML, 0, 18) . "<br />" . substr($textHTML, 18, 36);
} else {
echo $textHTML;
}
}
?>
</td>
</tr>
</table>
|
|
| Back to top |
|
 |
bebil
Joined: 21 Oct 2005 Posts: 2
|
Posted: Fri Oct 21, 2005 10:17 am Post subject: Re: TABLE fixed width -how to? |
|
|
hi, sorry I was doing something very dumb,.... my test data was mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
or something to that effect so it treated it like 1 word and couldnt break it down so it could be put on a different line.
thanks alot for your help...much appreciated. |
|
| Back to top |
|
 |
webmaster Site Admin

Joined: 17 Aug 2004 Posts: 3642 Location: Sweden
|
Posted: Fri Oct 21, 2005 12:07 pm Post subject: Re: TABLE fixed width -how to? |
|
|
Did my solution work? It will work with up to words with 36 chars.
Another solution cuold be a scroll like:
| Code: |
| <div style="width:160px;overflow:scroll;">111111111111111111111111111</div> |
|
|
| Back to top |
|
 |
|