Forum Moderators: open
I have a .php page where I display member comments and entries. The content is stored in a MySQL database which I call upon to display the comments and entries. The problem is that sometimes a member will use a long URL or unbreakable text (e.g. abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwzyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz)
This long extended text will change the size of my table instead of staying formatted. This change will change the width of my page, where the bottom scrollbar will show and need to be moved to the right to see all the text. I would like for my table to stay static (my recommended width) no matter how long the URL or unbreakable text is. How can I accomplish this? Please advise. Thanks.
One thing you can do is is place the table inside a <div style="height:600;width:800; overflow:auto"></div>. This will mean scrollbars appear in the div when the table expands - but will leave the width of your page unchanged.
You say you are using PHP - you should be able to use PHP to check the length of the text or URL string in the database and transform it by adding, for example, a
<br> at appropriate points. There is also a
<wbr> element which places a line break only when required, but it has been deprecated for a long while now and won't validate in HTML4/XHTML (and I will probably be shot down for suggesting it!).
I have used the suggestion of Iguana and I now have it formatted to the best fitting format. Though, I would be interested in knowing how I can add <br> in the database as you suggested. Please keep in mind I use MySQL and this is "on the fly" content, which changes in real-time.
Thanks.
[ca3.php.net...]