I have noticed that when we use code markups, the code gets re-formatted and syntax-highlighted; but if a block of code of say, 100 lines, is posted, all the lines are visible.

Instead, what about using the vertical scrollbar and limiting the code snippet size to a fixed maximum length, say 20 lines, allowing the user to see the rest of the code using the scrollbar?


I think this happens already. Take a look at this question for an example of a question with a large block of code posted.


Mike's correct, this is already the default behavior, are you using some custom script or stylesheet that's overriding the overflow: auto; on the <pre> element, or possibly using a browser that doesn't support max-height?

The relevant styling (as of the time of this post) is this:

pre {
  max-height: 600px;
  overflow: auto;
  width: auto;
  • Related: stackoverflow.com/questions/7707/… and specifically Jeff's answer. – Grace Note Jun 9 '10 at 11:48
  • @ccomet: Ah IE, the special kid...I'd call this a non-issue, an inferior browser will yield an inferior experience, same goes for buying a car (though it's a free choice here, and by inferior I mean in terms of supporting these CSS properties). I wouldn't say this is broken, it works, it just isn't the optimal experience. – Nick Craver Jun 9 '10 at 12:00
  • It isn't always a free choice. – mmyers Jun 9 '10 at 21:52
  • @mmyers - I meant cost-wise :) I understand it may be a limited choice, I have several friends in that situation where they work. – Nick Craver Jun 10 '10 at 1:04
  • Thanks guys, I am using IE7. Let me try the same with some other browsers. – bdhar Jun 22 '10 at 4:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .