Re: breaking content automatically into columns or rows
- From: Jeff North <jnorthau@xxxxxxxxxxxx>
- Date: Tue, 10 Feb 2009 10:34:53 GMT
On Sun, 8 Feb 2009 12:43:22 -0800 (PST), in comp.lang.javascript Bob
<bchildress06@xxxxxxxxx>
<73a6c018-2617-4dfe-b297-1bc1306c4da3@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
| Hi,
| I would like to put html content into a table that will automatically
| divide it into fixed sized rows and columns. For instance, I would
| like to be able to specify that a cell is say 100px by 500 pix and
| then for content that is 1000 pix have it automatically divide it into
| 2 equally sized cells and for content that is 1500 pix break it into
| 3, etc. Is this possible to accomplish with javascript or CSS?
|
| Or alternatively is there a way for me to break a document into a
| bunch of columns each one with a fixed and predetermined width and
| height and the number of columns varying based on the length of the
| document?
|
| Thanks,
| Bob
I've seen this done on a news site (sorry lost the link and it has
been 3-4 years now).
Basically what they did was:
take the text that needed to be displayed and placed in to a div of
the first columns' width.
Replicated this data for the number of columns that were to be
displayed. (the site allowed for 1-5 columns and changing the font
size).
They then calculated what text was display (starting and ending
positions) of the current column.
Adjusted the divs height for lines that were only partially displayed.
These calcs would be take to the next column as the starting position.
Repeat the above until all text was processed.
Display the first set of columns.
From what I can remember is that each sentence had a 'marker' as tohelp with the calculation of the text start/stop positions.
The site only displayed text in these columns.
In another post you mentioned that you wanted any type of html markup
to be broken into columns. This is not doable. For example, an image
is displayed half way down column 1 and is greater than the columns
height - how would you cater for that? Another example, same image
same position but it's width is 3.5 columns wide.
The same goes for tables - how would you split it up?
Lists would be relatively easy though.
But don't be too disheartened - look at:
https://developer.mozilla.org/en/CSS3_Columns
.
- References:
- Prev by Date: Re: question on event call to an iframe in designMode (IE7)
- Next by Date: Re: question on event call to an iframe in designMode (IE7)
- Previous by thread: Re: breaking content automatically into columns or rows
- Next by thread: Modernizing script that rotates images with links
- Index(es):
Relevant Pages
|