By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,664 Members | 1,669 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,664 IT Pros & Developers. It's quick & easy.

creating "newspaper column" output

P: n/a
Anyone out there have any tricks or scripts to take some text of
unknown length and display it in two (or more) columns of equal
height?
The text may or may not contain "hard-coded" linebreaks or other
formatting such as [UL]s.

why there's not a columns tag in HTML is mystery
<COLUMNS col=3>
wouldn't this be grand
</COLUMNS>
Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Brad Kent wrote:
Anyone out there have any tricks or scripts to take some text of
unknown length and display it in two (or more) columns of equal
height?
The text may or may not contain "hard-coded" linebreaks or other
formatting such as [UL]s.

why there's not a columns tag in HTML is mystery
<COLUMNS col=3>
wouldn't this be grand
</COLUMNS>


What's wrong with a table -- you CAN predetermine it's height and width.

<table> <tr> <td>text</td><td>second col</td> </tr></table>

Michael.
Jul 17 '05 #2

P: n/a
"Brad Kent" <bk***********@yahoo.com> wrote in message
news:7a**************************@posting.google.c om...
Anyone out there have any tricks or scripts to take some text of
unknown length and display it in two (or more) columns of equal
height?
The text may or may not contain "hard-coded" linebreaks or other
formatting such as [UL]s.


Ouch!

Why not force the author to break down the text into the relevant columns by
placing two text boxes on the the entry screen and allowing them to preview
the result?
Jul 17 '05 #3

P: n/a
"Brad Kent" <bk***********@yahoo.com> wrote in message
news:7a**************************@posting.google.c om...
Anyone out there have any tricks or scripts to take some text of
unknown length and display it in two (or more) columns of equal
height?
The text may or may not contain "hard-coded" linebreaks or other
formatting such as [UL]s.

why there's not a columns tag in HTML is mystery
<COLUMNS col=3>
wouldn't this be grand
</COLUMNS>


Netscape 4 had the MULTICOL tag I think. There're also some CSS styles for
spliting paragraphs into columns but I don't think current browsers support
them.
Jul 17 '05 #4

P: n/a
bk***********@yahoo.com (Brad Kent) wrote in message
news:<7a**************************@posting.google. com>...

Anyone out there have any tricks or scripts to take some text of
unknown length and display it in two (or more) columns of equal
height?
I humbly suggest, forget it. You can break the text into columns,
but you will not be able to enforce the correct pagination in
print. For example, you may have something like this:

This is the first This ir the second
column; it must be column; it must be
read first before read after you read
proceeding to the the first column.
second column.

And when you print it out, you can easily get:

This is the first This ir the second
column; it must be column; it must be
------------------ Page Break ------------------
read first before read after you read
proceeding to the the first column.
second column.
why there's not a columns tag in HTML is mystery


No mystery; it's hard to render correctly without knowing
what the media is...

Cheers,
NC
Jul 17 '05 #5

P: n/a
Brad Kent wrote:
Anyone out there have any tricks or scripts to take some text of
unknown length and display it in two (or more) columns of equal
height?


http://css.nu/examples/css-columns.html

Although this is only an approximation. Closer approximations would
probably require a bit of JavaScript magic to first determine the size
of your window, and then compute the layout of text within that window.
That's a bit of work...

/Marcin
Jul 17 '05 #6

P: n/a
Marcin Dobrucki wrote:
Brad Kent wrote:
Anyone out there have any tricks or scripts to take some text of
unknown length and display it in two (or more) columns of equal
height?

http://css.nu/examples/css-columns.html

Although this is only an approximation. Closer approximations would
probably require a bit of JavaScript magic to first determine the size
of your window, and then compute the layout of text within that window.
That's a bit of work...

/Marcin


Are you trying to do this dynamically as they type? or just displayed
after-the fact?

After-the-fact:

If the "columns" will NEVER contain anything but text:
$inputtext is used to store the text in question.
and for this exercise $inputtext is 630 characters
let's say Col1/Col2 size is 500 characters
So, we locate character 500 and in reverse search for the last space
character. and for argument sake, the last space character is at 496.

(or another way is to add each word to an array as long as it is < 500
characters. etc...)

Col1(type is wrapped text) = character 1-496
Col2 (type is wrapped text)= the first character after the last space
through character 630.

now place them in the proper columns in a table row.

The thing I don't like about using browser version specific extensions
and code is that it forces one to use the browser that only works with
this particular site. I like the browser I use, but sometimes I am
forced to you IE due to this coding mindset that "EVERYONE uses brandX".

.... Yes, I could write the code, but I leave it as a learning exercise
for you to learn...

Michael Austin.
Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.