@macshonle@c.cim - Mastadon

03 June 2010

Painless Code Listings, CSS edition

We've seen Painless Code Listings for LaTeX. Now, here's what I have for HTML:
/* Adds scroll bars when code snippet is too large */
pre {
  padding: 3px;
  background: #FFFFFF;
  width: 95%;
  max-height: 5in;
  overflow: auto;
  border: silver 1px dotted;
}
I used this for my Quine page, and it seems to have worked out pretty well. It adds both vertical and horizontal scroll bars, which seems more humane when you want people to be able to read your content and copy and paste your snippets. You can see what it looks like, above.