Byteflow usability quick change.

05.06.2008 10:11

posted by: Benjamin Smith

Posted Under: , , ,

Submitted this to the byteflow hackers, figured some might be able to use it as well. Code blocks don’t wrap lines (<pre>), probably want to have control of how it overflows.

Here’s the patch:

# HG changeset patch
# User bsmith@linode.just-another.net
# Date 1212606740 14400
# Node ID 9337a362eeacbe88db2da11d38e238db2644e31b
# Parent  93c1106436dd09dde52ec1dd25cfbbeca7cec00b
Add scroll if lines don't wrap in code blocks.

diff -r 93c1106436dd -r 9337a362eeac static/css/highlight.css
--- a/static/css/highlight.css  Wed Jun 04 09:47:44 2008 +0300
+++ b/static/css/highlight.css  Wed Jun 04 15:12:20 2008 -0400
@@ -1,6 +1,7 @@ pre code {
 pre code {
    display: block;
    background: #F0F0F0;
+   overflow:auto;
 }

pre code,
2 comments | 0 pingbacks
Add post to: Delicious Reddit Slashdot Digg Technorati Google
Comment

Comments

Mike 5.06.2008 13:35

I get annoyed with having scrollbars in code samples (the result of overflow:auto), so when I found this CSS tidbit the other day I was quite happy:

pre {
    white-space: pre; /* CSS2 */
    white-space: -moz-pre-wrap; /* Mozilla */
    white-space: -hp-pre-wrap; /* HP printers */
    white-space: -o-pre-wrap; /* Opera 7 */
    white-space: -pre-wrap; /* Opera 4-6 */
    white-space: pre-wrap; /* CSS 2.1 */
    white-space: pre-line; /* CSS 3 (and 2.1 as well, actually) */
    word-wrap: break-word; /* IE */
}

The net effect is that your text will wrap rather than forcing the pre area to have a horizontal scrollbar.

reply
Benjamin Smith 5.06.2008 14:00

Our opinions on this vary quite a bit :). I don’t like wrapping in a pre. I expect pre to respect what it’s made to do, preserving line breaks and whitespace. I’d rather it scroll than modify what goes in it.

Really neat trick though!

reply

Comment form for «Byteflow usability quick change.»

Required. 30 chars of fewer.

Required.

captcha image Please, enter symbols, which you see on the image