Wrox Programmer Forums
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 11th, 2007, 06:04 AM
Authorized User
 
Join Date: Sep 2006
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default Width Irritation

Hi everyone,

I have a table which, in order to line up with other information, needs to have very exact column widths.

So far I have implemented the following with normal HTML tables ...

<td align="RIGHT" width="77">

... which works OK most of the time.

However, sometimes the data contained in the table overshoots the column width and the table starts to 'distort'.

So my question is whether there is a way to make the column widths 'absolute' thereby suppressing any changes caused by querks in the data?

Maybe this has something to do with the declared table width ...

<TABLE width="999" border="1" ALIGN="LEFT">

... or should I leave out a declared table width when the colum widths are specifically declared?

Many thanks for any tips you can give me.

Regards,
Alan Searle


 
Old October 26th, 2007, 07:17 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Default the text insied the table will get wrapped. Only exemption is when there is a text without any space between it and it is large enough to occupy the complete width of the window then the table gets stretched. There is no solution for this as far as i know. Only thing you can do is write some code which will check for this special case and inserts a line break [br tag] after few characters so that the text forcibly gets to next line.

Hope it solves your problem.


- Rakesh
 
Old October 30th, 2007, 02:13 AM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

Quote:
quote:Originally posted by rakesh_mscit
 Default the text insied the table will get wrapped. Only exemption is when there is a text without any space between it and it is large enough to occupy the complete width of the window then the table gets stretched. There is no solution for this as far as i know. Only thing you can do is write some code which will check for this special case and inserts a line break [br tag] after few characters so that the text forcibly gets to next line.


Actually there is a simpler solution with CSS. Include a style rule for your table cells

td {
overflow:auto;
}

If the contents of the table cell, overflow the available content, it will add scrollbars. Scrollbars in this context frequently don't look great, but if the alternative is blasting a hard-won design then it's a good trade off. The nice thing is that, if the content doesn't overflow, auto will NOT introduce scrollbars; they're only added if necessary.

-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Screen width day10 Classic ASP Basics 1 March 2nd, 2007 12:58 PM
Printing the whole width marclena Javascript 1 July 1st, 2005 06:59 AM
Height and Width? venkatesh_anmca Beginning VB 6 0 January 31st, 2005 05:13 AM
Column width immanuelsamuel Oracle 2 March 13th, 2004 10:30 AM
Width in pixels from width in percentage bsausser Classic ASP Basics 1 December 31st, 2003 02:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.