CSS display vertical scrollbar on pre tag

22,251

Solution 1

http://jsfiddle.net/UTYzd/

you are loading css from external file: bootstrap-combined.min.css try to change the following:

word-break word-wrap white-space

pre {
    height: auto;
    max-height: 200px;
    overflow: auto;
    background-color: #eeeeee;
    word-break: normal !important;
    word-wrap: normal !important;
    white-space: pre !important;
}​

Solution 2

You could try and wrap the 'pre' section tags with a 'div', and apply the CSS on that div.

Here is a jsfiddle.

Share:
22,251
Justin
Author by

Justin

Updated on July 09, 2022

Comments

  • Justin
    Justin almost 2 years

    I am trying to get the vertical scrollbar to show in Chrome running latest version 21 when the content of a pre tag overflows. I can't get the vertical scrollbar to actually display though.

    See this jsFiddle: http://jsfiddle.net/justink101/2tJmC/

    EDIT

    On Mac - OSX

    • Sreenath S
      Sreenath S almost 12 years
      which version of chrome exactly ? i'm getting the scrollbar on chrome v21.0.1180.89 m
    • OJay
      OJay almost 12 years
      yeah, same here using v21 chrome
    • Madara's Ghost
      Madara's Ghost almost 12 years
      I see the scrollbar in that fiddle.
    • Justin
      Justin almost 12 years
      Version 21.0.1180.89 Here is a screenshot: i.imgur.com/MfT01.png
    • Sreenath S
      Sreenath S almost 12 years
      there is no style called overflow-y:none;, why is it there in you CSS ?
    • Jezen Thomas
      Jezen Thomas almost 12 years
      I don't see the scrollbar, even setting overflow-y:scroll;. Craaazy.
    • joshnh
      joshnh almost 12 years
      Wow, I can replicate the issue. No idea what's going on!
    • Ghassan Elias
      Ghassan Elias almost 12 years
      @SreenathSoman :D i can't believe you just say that!
    • Sreenath S
      Sreenath S almost 12 years
      @Gustonez sorry for being delusional ;) developer.mozilla.org/en-US/docs/CSS/overflow-y , I can't see any none option in there.
    • Ghassan Elias
      Ghassan Elias almost 12 years
      Oh yeah i thought you meant the overflow-y