Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

text columns with css

Status
Not open for further replies.

sundemon

Programmer
Aug 11, 2001
125
Is there a way to create columns of text where the overflow from one column can dynamically (say, in response to variables like page/window size) transfer to a following column?

sundemon
 
Hi Sundemon,

I don't think plain HTML is capable of doing this. You have to build a dynamic webpage using ASP or PHP to achieve this.

Greetings, Dutch
 
Hi dutch,
thanks for responding. I am curious, how do those server side languages detect overflow from a page or div element?
sundemon
 
Well, I think you can do it BUT with "heavy-heavy" client side script : you'll have to proceed this way :
- take one by one all the cells contained in your table using &quot;children&quot; method that'll return a collection of all children of a given HTML Element (<Table>.children will return all <TR>'s, <TR>.children will return all <TD>'s).
- for each cell (<TD>) returned, check it's text length by getting its &quot;innerHTML&quot; or &quot;innerText&quot; attribute. If the length is too long, cut it the length you want (using Right and Left functions) and add the cutted part to the begining of next cell innerHTML (or &quot;innerText&quot;).

Note : This is going to be a long codind and I think this'll take a long time to run. Water is not bad as long as it stays out human body ;-)
 
thanks targol,
I guess what I was hoping for isn't practial at this time. The idea of &quot;too long&quot; relies not only on the string length, but spatial considerations like font size vs. window size. I guess what is really needed is a way to separate &quot;overflow&quot; in an HTML element from what &quot;fits&quot; in a given situation. To my knowledge, there is no way to detect that.
Oh well, I guess I was hoping for a built in CSS feature, which doesn't exist yet.
Thanks again, guys-
sundemon
 
I too am looking for a way to detect an overflow condition and take some sort of action.

If you set values for left, top, height and width and also let overflow be visible. Could you fire an onload() to check for overflow by testing to see if bottom was more than top plus height?

If it was, then you might be able to chop text off the end of the string and insert it into a different display area.

If possible, and I haven't even considered coding a test, it would be a performance issue I think.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top