[thesite] (Fwd) Re: [css-d] Opera and overflow

Simon Coggins ppxsjc1 at nottingham.ac.uk
Wed Jun 5 11:14:10 CDT 2002


> remember my attempts to create a scrollable <pre> that could  
> replace our textarea? 
> 
> well, at least in O6, i now know it's a bug... and i don't much care  
> for the hack... 

When I was messing around with this I discovered an interesting
Opera-specific CSS tag which could be of help here:

white-space: -pre-wrap;

(yes the - at the beginning is right).

The result is the same as white-space: pre;, except that it wraps long
lines. Not ideal for copying and pasting, but perhaps an acceptable
workaround?

Some more info:

http://www.opera.com/docs/specs/opera5/
In addition Opera accepts a non-standard value for the CSS2 white-space
property, namely white-space: -pre-wrap. This value is exactly like
white-space: pre with the exception that lines will wrap if wider than wider 
than the containing box. This is particularily handy for plaintext formats
with unpredictable position of line break characters, like email messages. 
Unlike the other white-space settings hoawever, -pre-wrap will display tab 
characters like small boxes.

Seems like it's supported from Opera 4+:

http://www.blooberry.com/indexdot/css/supportkey/text.htm

I had some success using the following rules:

.codeblock {
  width: 350px;
  padding: 20px 10px;
  border: 1px solid #000;
  background: #9AA486;
  white-space: -pre-wrap;
  overflow: auto;
}

Good luck,

Simon




More information about the thesite mailing list