homepage Welcome to WebmasterWorld Guest from 54.196.24.103
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
How can I make static HTML tables?
antonaf




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

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.

 

Iguana




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

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.

antonaf




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

Thanks Iguana,

I'll give this a try.

encyclo




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

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

antonaf




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

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.

Thanks.

antonaf




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

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.

encyclo




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

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:

[ca3.php.net...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved