Word Wrap in html tales ??

anuj_web

New Member
Messages
145
Reaction score
0
Points
0
Word Wrap in html tables ??

Hi,

how can i do the same..please

if not is there an alternative..without CSS please

thanks
 
Last edited:

t2t2t

New Member
Messages
690
Reaction score
0
Points
0
More information would be nice to have...

anyways if you already know the css for it and don't want to add CSS (Don't see a reason why :dunno:), add style="{CSS STYLE HERE}" to the tag, example:
HTML:
<div style="height: 100px;"></div>
 

anuj_web

New Member
Messages
145
Reaction score
0
Points
0
Re: Word Wrap in html tables ??

Sorry for that spelling mistake also.....(tales)

Actually ,right now I am unaware of CSS as such and cant put my time learning or messing with it...

if there is an alternative then please point it out....or else if CSS code is a one liner then please guide me through that

I used this CSS code :

<style type="text/css">
table {
table-layout:fixed;
width:100%;
border:1px solid #f00;
word-wrap:break-word;
}
</style>

It works fine if the text has spaces but is messed up when the text has no breaks in itself
 
Last edited:

javayathzee

New Member
Messages
38
Reaction score
0
Points
0
you're not going to find a way to fix it if the text has no breaks. HTML doesn't handle that kind of thing at all.
sorry
 

rockee

New Member
Messages
120
Reaction score
0
Points
0
Try adding this to your CSS:

text-align: justify;

Regards,
Rocky
 

woiwky

New Member
Messages
390
Reaction score
0
Points
0
The best you could do with the css is 'overflow: scroll;' I believe. However, if you don't mind using php or if the text is already coming from php, then I would recommend using the wordwrap() function.
 

anuj_web

New Member
Messages
145
Reaction score
0
Points
0
Hi,
thanks all for replying

the above code is working just fine....

I know i am going just a bit offtopic..
but can you help me with this code I want to generate a dynamic html table from a mysql query resultset

Code:
$num_results = mysql_num_rows($result);
      for ($i=0; $i < $num_results; $i++) 
      {
        echo '<tr> <td align="center">'.$row["name"].'</td>
        <td align="center">'.$age.'</td>
        <td align="center"><div STYLE="word-wrap: break-word">'.$row["add"].'</div></td>
        <td align="center">'.$row["dis"].'</td>
        <td align="center">'.$row["divi"].'</td>
        <td align="center">'.$row["phone"].'</td>
        <td align="center">'.$row["email"].'</td> </tr>';
      }
$age is calculated not from the table

I kinda kno wher the problem is ..may b i cannot go to the next record..and how i am fetching the FIELDS from the recordset

the O/P of this code... :( it generates nothing

thanks
 
Last edited:

t2t2t

New Member
Messages
690
Reaction score
0
Points
0
PHP:
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
            echo '<tr> <td align="center">'.$row['name'].'</td>
        <td align="center">'.$age.'</td>
        <td align="center"><div STYLE="word-wrap: break-word">'.$row['add'].'</div></td>
        <td align="center">'.$row['dis'].'</td>
        <td align="center">'.$row['divi'].'</td>
        <td align="center">'.$row['phone'].'</td>
        <td align="center">'.$row['email'].'</td> </tr>';

}
(taken straight off php manual)
 

anuj_web

New Member
Messages
145
Reaction score
0
Points
0
The problem with this code is that when we use

'.row['fieldname'].'

dont you think the echo command will use the ' inside the brackets as its parameters ..i mean I started the echo command with a single quote

I have just gone thru the manual..it was just wat i wanted

thanks a ton
 
Last edited:
Top