Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

It may not be for everyone, but the way inline code and code blocks are displayed with a border and distinct background color on many sites really helps me when reading text interspersed with code. After reading Repainting the Monastery the other day, I decided to spend an evening learning some basic CSS so that I could make my own PerlMonks experience more pleasant.

Below is the modest CSS snippet I'm currently testing out. I also put it up as a GitHub gist so that I can point to it from Display Settings (for anyone that doesn't know where to add CSS code or point to external CSS links).

tt.codetext, tt.inlinecode { border: 1px solid gray; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; font-family: Mensch,Menlo,Monaco,Consolas,"Courier New",monospace; white-space: pre; color: black; background-color: #FFF4F4; word-wrap: break-word; } tt.codetext { display: block; margin-right: 5px; padding: 4px 4px 4px 4px; font-size: 100%; line-height: 13px; } tt.inlinecode { padding: 2px 1px 2px 1px; font-size: 60%; line-height: 15px; } @media screen and (max-device-width:480px) { tt.inlinecode { font-size: 100%; } }

I use PM's red theme, so I gave my code blocks a faint red color to keep with the theme; however, this background color can easily be changed by adjusting background-color: #FFF4F4;. There are a couple other things I'm debating, including whether I prefer it without word-wrap: break-word;, but I figured I'd post it here in hopes that someone might find it useful and that other people might also share any nice CSS customizations they have done.

On the theme of sharing... If there are many people with custom PerlMonks CSS, it might be nice to have a node dedicated to snippets or external links to supplement the primary themes that are available in Display Settings. This might help quench some people's thirsts for a 'repainted' monastery, without actually having to do any real painting.

EDIT: I posted screenshots of how it looks on my screen with and without this CSS.

EDIT #2: Added a bit so that things look as expected when viewing PM from my phone.


In reply to CSS Show and Tell: Colored Code by frozenwithjoy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (9)
    As of 2014-07-29 10:00 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (213 votes), past polls