homepage Welcome to WebmasterWorld Guest from 54.234.0.85
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

    
print all text in a textarea
including text below the scrollbar
Purple Martin

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3106238 posted 3:50 am on Oct 3, 2006 (gmt 0)

I want to print a textarea with all the text in it... including the text that has scrolled off the bottom of the area. By default, browsers just truncate the text at the end of the visible area and don't print any text that you'd need to scroll to see. Is there a CSS trick to this?

 

Setek

5+ Year Member



 
Msg#: 3106238 posted 4:03 am on Oct 3, 2006 (gmt 0)

I've already tried this - using combinations of methods for setting 100% height, or visible overflow, minimum height, that sort of thing.

I couldn't get anything to work.

So I'm also interested to see if someone found a solution that's cross-browser compatible, or there isn't one.

foobar

5+ Year Member



 
Msg#: 3106238 posted 5:23 am on Oct 3, 2006 (gmt 0)

Is it necessary to have the text in a textarea input element? If you're just displaying something like a TOS in a scrollable box, why don't you try this instead of a textarea:

<div style="width:500px;height:500px;overflow:auto;border:1px #000 solid;">
All the text here...
</div>

It'll look almost like your textarea, but it can easily print by changing the CSS. I've used inline styles, but you'd want to use an external stylesheet.

Purple Martin

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3106238 posted 12:17 am on Oct 4, 2006 (gmt 0)

Nice idea foobar. Unfortunately it is necessary to have a textarea form element, because it is a data input form with a couple of fields which take a large amount of text with line breaks (e.g. a project description).

penders

WebmasterWorld Senior Member penders us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



 
Msg#: 3106238 posted 12:54 am on Oct 4, 2006 (gmt 0)

If you can't print the entire <textarea> directly then, using JavaScript, you might be able to copy it's contents into a DIV (perhaps in another window) and print that. Kind of how foobar suggested. To preserve line-breaks, you could try using
white-space:pre-wrap; (although not very well supported!) or manually replace every new-line with a <br> ...?
Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved