Forum Moderators: open

Message Too Old, No Replies

Making the table cell width fixed irrespective of cell content length

         

bvinodkumar

9:10 am on Mar 4, 2004 (gmt 0)



Hi All,

There is problem i am facing with the table cell. I am using table for layout purpose. So with of the table cell is fixed for me. Each cell will contain a single word. If the word length is with respect to the table cell width i am not having any problem.

When the length of the word in more (For eg, if table cell can accept 15 chars and my word length is 30 chars), the table cell automatically grows to 30 char length.

Is there any way to fix the table cell length, irrespective of the word length.

I am having one solution in mind. It is round about one. If we know the table cell width, we can calculate approximately how many chars will fit with in that cell and correspondingly add an empty space in the word such that a fresh line will start with in the cell.

But this solution is bit tough to maintain. Is there any direct way for this problem?

Thanx in advance,
Vinod.

PatomaS

12:17 am on Mar 5, 2004 (gmt 0)

10+ Year Member



Well i think i don't understand well enough your plan, but you can try using the <pre> tag, it tells the navigators to respect the aspect of the text, so the browser have to show it exactly as is.

By the way, i know that IE 6 ignores this tag

[w3.org...]

This is the w3c page about text formatting and the pre tag

Hope it helps

tedster

5:56 am on Mar 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is no way to fix a table cell width absolutely -- user agents are always allowed discretion about cell width, no matter what the html attributes or css rules say. This is a necessity, or else we could write valid html that was impossible for a visual agent to render, tying the browser's code in knots.

So your "round about" approach is the only thing I can think of right now: doing some server side processing (or client-side for that matter) before outputting the page to insert line breaks as needed. Messy, though.