Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.


Greasemonkey script that allows you to click code regions on stack overflow (or other stack exchange sites) and have it expand to whatever size it needs. Get rid of those pesky scroll bars!

Click the code region to expand it


  • Click the code region to have it expand to whatever size it needs
  • Removes vertical scroll altogether (expands to full height)
    • Intelligently expands horizontally
      • Maxes out at window width so as not to make even more scroll bars
      • If it still doesn't fit, it shrinks the font size
  • Click again to return it to normal


Install user script here.
(view source)


Tested in Firefox (with Greasemonkey) and Chrome.

share|improve this question
awesome script! p.s. those scrollbars in the first screenshot are something else... –  Jeff Atwood Sep 5 '11 at 2:19
It's what I was looking for. One disadvantage is complicated text selection by touchpad –  Andy T Dec 4 '11 at 10:37
@AndyT - Yeah, because it just toggles on click, it can be a bit sensitive with what the browser/jQuery interprets as a click vs a text selection... Pretty easy to change the .click( to .dblclick( if you wanted it to expand on double click instead. –  Alconja Dec 4 '11 at 23:18
DoubleClick is often used for whole word selection. What about some small button at the top right corner. –  Andy T Dec 5 '11 at 19:37
...at the top right corner of code block? –  Andy T Dec 5 '11 at 19:53
That'd actually be a bit better in my opinion... having a button in the top right corner of the code block... –  Thomas W. Feb 6 '12 at 18:45

You must log in to answer this question.

Browse other questions tagged .