Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL

Message Too Old, No Replies

How can I make static HTML tables?



1:04 pm on Aug 26, 2005 (gmt 0)

10+ Year Member

I'm not an HTML guru, I only know the basics. I use FrontPage to create my pages.

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.


1:57 pm on Aug 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

I'm afraid you can't limit the width of tables or table columns where there are lines of unbreakable text.

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.


7:19 pm on Aug 26, 2005 (gmt 0)

10+ Year Member

Thanks Iguana,

I'll give this a try.


8:26 pm on Aug 26, 2005 (gmt 0)

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Thing is, the text has to go somewhere - either it is cut off and the overflow is invisible (which won't break your layout but will render the content useless), or you can force a scrollbar within a div as Iguana suggests (which is more functional but awkward), or you break your layout, or finally you ensure the text string can fit.

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

at appropriate points.

There is also a

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!).


1:30 am on Aug 27, 2005 (gmt 0)

10+ Year Member

Thanks for the tips encyclo very insigtful

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.



2:58 am on Sep 2, 2005 (gmt 0)

10+ Year Member

I was wondering is it possible for me to wrap the text when it reaches a specified length, regardless if it breaks or not?

**Remember the content is being pulled from a MySQL database in real-time and being displayed.

If you know a way for me to complete this, please advise! Thanks.


12:37 pm on Sep 2, 2005 (gmt 0)

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member

You might want to post in our PHP forum [webmasterworld.com] for a more detailed (and perhaps more accurate!) reply, but you should look at using something like the wordwrap function:



Featured Threads

Hot Threads This Week

Hot Threads This Month